Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using UnityEngine.UI;
- using System.Collections;
- public class Winner : MonoBehaviour
- {
- public float restartDelay = 5f;
- public static int score;
- private ScoreManager ScoreManager;
- Animator anim;
- float restartTimer;
- Text text;
- void Awake()
- {
- text = GetComponent<Text>();
- score = 0;
- anim = GetComponent<Animator>();
- }
- void Update()
- {
- if (score >= 10)
- {
- anim.SetTrigger("Winner");
- restartTimer += Time.deltaTime;
- if (restartTimer>= restartDelay)
- Application.LoadLevel(2);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment