Ejemplo n.º 1
0
 void Update()
 {
     Laps1            = Players[0].GetComponent <LapsCounter>().Lap;
     LapCounter1.text = Laps1 + "/" + manager.gameLaps;
     PlayerInfos();
     foreach (GameObject Guide in Guides)
     {
         Guide.GetComponent <SpriteRenderer>().material.color = Color.Lerp(StartingColor, EndColor, Time.time / 3f);
     }
     if (Laps1 >= manager.gameLaps)
     {
         Time.timeScale = 0.5F;
         Invoke("ResetTimeScale", 1);
         MiddleText.text = CheckPointScripts.CurrentLeader + " Has Won!";
         if (CheckPointScripts.CurrentLeader == "Player 1" && PointsAwarded == true)
         {
             Debug.Log("Awarded Winner Points to Player 1"); manager.player1Score += 500; PointsAwarded = false;
         }
         if (CheckPointScripts.CurrentLeader == "Player 2" && PointsAwarded == true)
         {
             Debug.Log("Awarded Winner Points to Player 2"); manager.player2Score += 500; PointsAwarded = false;
         }
         if (CheckPointScripts.CurrentLeader == "Player 3" && PointsAwarded == true)
         {
             Debug.Log("Awarded Winner Points to Player 3"); manager.player3Score += 500; PointsAwarded = false;
         }
         if (CheckPointScripts.CurrentLeader == "Player 4" && PointsAwarded == true)
         {
             Debug.Log("Awarded Winner Points to Player 4"); manager.player4Score += 500; PointsAwarded = false;
         }
         Invoke("BackToMainMenu", 3);
     }
     Countdown -= Time.deltaTime;
     if (Countdown < 3f && MiddleTextCleared == true)
     {
         MiddleText.text = "3";
     }
     if (Countdown < 2f && MiddleTextCleared == true)
     {
         MiddleText.text = "2";
     }
     if (Countdown < 1f && MiddleTextCleared == true)
     {
         MiddleText.text = "1";
     }
     if (Countdown < 0f && MiddleTextCleared == true)
     {
         MiddleText.text = "Go!";
         foreach (GameObject Player in Players)
         {
             Player.GetComponent <PlayerMovement>().enabled = true;
         }
     }
     if (Countdown < -0.5f && MiddleTextCleared == true)
     {
         MiddleText.text   = "";
         MiddleTextCleared = false;
     }
 }