Topic: Using 2D images or animations instead of Main Alert Text

I'm thinking of trying to add more style to my game, and there's only so much I can do with text. Would anyone know where to start with displaying this kind of animation on round start/perfect/KO/etc?

Share

Thumbs up Thumbs down

Re: Using 2D images or animations instead of Main Alert Text

I used the event system to cover some of my needs for my custom battle GUI.
I'd imagine you could enable and disable a GameObject with an animator component on it.
I think it automatically restarts the animation when the GameObject is enabled
Here's some code that might help. I just copied it from my battle GUI.

        private void OnRoundBegins(int newInt)
        {
            //UFE.CastNewRound(2);
            //This controls the delay of when the characters can move
            //Can add an option in the editor to control the delay on this;

            switch (UFE.gameMode)
            {
                case GameMode.TrainingRoom:
                    SetMainAlertVariables(MainAlertType.TopAlert, trainingName, mainAlertTextColorNormal, mainAlertDisableDelayOnRoundBegins);
                    SetMainAlertVariables(MainAlertType.BottomAlert, modeName, mainAlertTextColorNormal, mainAlertDisableDelayOnRoundBegins);
                    break;

                case GameMode.ChallengeMode:
                    break;

                default:
                    if (currentRound == UFE.config.roundOptions.totalRounds)
                    {
                        SetMainAlertVariables(MainAlertType.TopAlert, finalName, mainAlertTextColorNormal, mainAlertDisableDelayOnRoundBegins);
                        SetMainAlertVariables(MainAlertType.BottomAlert, roundName, mainAlertTextColorNormal, mainAlertDisableDelayOnRoundBegins);
                    }
                    else
                    {
                        SetMainAlertVariables(MainAlertType.TopAlert, roundName, mainAlertTextColorNormal, mainAlertDisableDelayOnRoundBegins);
                        SetMainAlertVariables(
                            MainAlertType.BottomAlert,
                            GCFreeStringNumbersManager.Instance.GetStringFromStringArray(GCFreeStringNumbersManager.Instance.positiveNumbers, currentRound),
                            mainAlertTextColorNormal,
                            mainAlertDisableDelayOnRoundBegins);
                    }
                    break;
            }
        }

        private void OnRoundEnds(ControlsScript winner, ControlsScript loser)
        {
            switch (UFE.gameMode)
            {
                case GameMode.ChallengeMode:
                    break;

                default:
                    if (winner == null || loser == null)
                    {
                        if (UFE.timer == 0
                            && UFE.p1ControlsScript.currentLifePoints == UFE.p2ControlsScript.currentLifePoints
                            && UFE.p2ControlsScript.currentLifePoints == UFE.p1ControlsScript.currentLifePoints)
                        {
                            SetMainAlertVariables(MainAlertType.TopAlert, timeOutName, mainAlertTextColorTimeOut, mainAlertDisableDelayOnRoundEnds);
                            SetMainAlertVariables(MainAlertType.BottomAlert, drawName, mainAlertTextColorDraw, mainAlertDisableDelayOnRoundEnds);
                        }
                        else if (UFE.timer != 0
                            && UFE.p1ControlsScript.currentLifePoints == 0
                            && UFE.p2ControlsScript.currentLifePoints == 0)
                        {
                            SetMainAlertVariables(MainAlertType.TopAlert, doubleKoName, mainAlertTextColorDoubleKo, mainAlertDisableDelayOnRoundEnds);
                            SetMainAlertVariables(MainAlertType.BottomAlert, drawName, mainAlertTextColorDraw, mainAlertDisableDelayOnRoundEnds);
                        }
                        return;
                    }

                    currentRound = winner.roundsWon + loser.roundsWon + 1;

                    switch (winner.playerNum)
                    {
                        case 1:
                            int p1Length = player1GUI.playerRoundsGUI.Length;
                            for (int i = 0; i < p1Length; i++)
                            {
                                if (UFE.timer == 0)
                                {
                                    SetMainAlertVariables(MainAlertType.TopAlert, timeOutName, mainAlertTextColorTimeOut, mainAlertDisableDelayOnRoundEnds);

                                    player1GUI.playerRoundsGUI[winner.roundsWon - 1].roundImage.color = roundImageColorTimeOut;
                                }
                                else if (UFE.timer != 0
                                    && winner.currentLifePoints == winner.myInfo.lifePoints)
                                {
                                    SetMainAlertVariables(MainAlertType.TopAlert, perfectName, mainAlertTextColorPerfect, mainAlertDisableDelayOnRoundEnds);

                                    player1GUI.playerRoundsGUI[winner.roundsWon - 1].roundImage.color = roundImageColorPerfect;
                                }
                                else if (UFE.timer != 0
                                    && winner.currentLifePoints != winner.myInfo.lifePoints)
                                {
                                    SetMainAlertVariables(MainAlertType.TopAlert, koName, mainAlertTextColorKo, mainAlertDisableDelayOnRoundEnds);

                                    player1GUI.playerRoundsGUI[winner.roundsWon - 1].roundImage.color = roundImageColorKo;
                                }
                            }
                            break;

                        case 2:
                            int p2Length = player2GUI.playerRoundsGUI.Length;
                            for (int i = 0; i < p2Length; i++)
                            {
                                if (UFE.timer == 0)
                                {
                                    SetMainAlertVariables(MainAlertType.TopAlert, timeOutName, mainAlertTextColorTimeOut, mainAlertDisableDelayOnRoundEnds);

                                    player2GUI.playerRoundsGUI[winner.roundsWon - 1].roundImage.color = roundImageColorTimeOut;
                                }
                                else if (UFE.timer != 0
                                    && winner.currentLifePoints == winner.myInfo.lifePoints)
                                {
                                    SetMainAlertVariables(MainAlertType.TopAlert, perfectName, mainAlertTextColorPerfect, mainAlertDisableDelayOnRoundEnds);

                                    player2GUI.playerRoundsGUI[winner.roundsWon - 1].roundImage.color = roundImageColorPerfect;
                                }
                                else if (UFE.timer != 0
                                    && winner.currentLifePoints != winner.myInfo.lifePoints)
                                {
                                    SetMainAlertVariables(MainAlertType.TopAlert, koName, mainAlertTextColorKo, mainAlertDisableDelayOnRoundEnds);

                                    player2GUI.playerRoundsGUI[winner.roundsWon - 1].roundImage.color = roundImageColorKo;
                                }
                            }
                            break;
                    }
                    break;
            }
        }

Share

Thumbs up Thumbs down