コード例 #1
0
ファイル: Timer.cs プロジェクト: deerter/Scarlet-Flash
 void Start()
 {
     if (CurrentFightStats.GetTimer() > 0)
     {
         //timer = 100;
         timer        = CurrentFightStats.GetTimer();
         counter.text = timer.ToString();
     }
     else
     {
         timer            = -1;
         counter.fontSize = 100;
         counter.text     = "\u221E"; //Infinity symbol
     }
 }
コード例 #2
0
ファイル: FightManager.cs プロジェクト: deerter/Scarlet-Flash
    void Update()
    {
        if (!fightStarted)
        {
            AnnounceFight();
        }
        if (fightStarted)
        {
            StartCoroutine(SwapCharacterWhenDead(player1));
            StartCoroutine(SwapCharacterWhenDead(player2));
            //Declares a winner if all healthBars has been depleted
            if (CheckLifeBars(player1) && !fightEnded)
            {
                SetWinner(player2);
            }
            if (CheckLifeBars(player2) && !fightEnded)
            {
                SetWinner(player1);
            }

            //Prompts the restart fight screen and stops the timer
            if (fightEnded && !restartPrompt)
            {
                if (CurrentFightStats.GetTimer() > 0)
                {
                    timerCounter.GetComponent <Timer>().StopTimer();
                }
                StartCoroutine(PopUpRestartFight());
            }

            //Counts down the time
            if (timerCounter.GetComponent <Timer>().GetTimer() > 0 && !fightEnded)
            {
                timerCounter.GetComponent <Timer>().DecreaseTimer();
            }
            if (timerCounter.GetComponent <Timer>().GetTimer() == 0 && !fightEnded)
            {
                fightEnded = true;
                TimeUpVictory();
            }
        }
    }