dutchdragon3

Winner Script

Apr 2nd, 2016
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.67 KB | None | 0 0
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. using System.Collections;
  4.  
  5. public class Winner : MonoBehaviour
  6. {
  7.     public float restartDelay = 5f;
  8.     public static int score;
  9.     private ScoreManager ScoreManager;
  10.  
  11.     Animator anim;
  12.     float restartTimer;
  13.     Text text;
  14.  
  15.  
  16.     void Awake()
  17.     {
  18.         text = GetComponent<Text>();
  19.         score = 0;
  20.         anim = GetComponent<Animator>();
  21.     }
  22.  
  23.  
  24.     void Update()
  25.     {
  26.  
  27.         if (score >= 10)
  28.  
  29.         {
  30.             anim.SetTrigger("Winner");
  31.  
  32.  
  33.             restartTimer += Time.deltaTime;
  34.  
  35.             if (restartTimer>= restartDelay)
  36.  
  37.             Application.LoadLevel(2);
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment