private float timeSpent; //how much time the player spent in completing the level // Start is called before the first frame update void Start() { levelCompetePanel = GameObject.Find("LevelCompletePanel"); levelCompetePanel.SetActive(false); score = maxScore; timeSpent = 0f; //time when the level starts threshold = 0; percentage = 0f; tracker = gameObject.GetComponent <EnemyTracker>(); spawners = GameObject.FindGameObjectsWithTag("Spawner"); foreach (GameObject spawner in spawners) { thresholds.Add(spawner.gameObject.GetComponent <WaveSpawner>().EnemyNumber()); } foreach (int val in thresholds) { threshold += val; // total number of enemies in level } Debug.Log("Threshold : " + threshold); completionBar.SetMaxValue(100); completionBar.SetValue(0); }
// Start is called before the first frame update void Start() { healthBar.SetMaxValue(health); healthBar.SetValue(health); player = GameObject.FindGameObjectWithTag("Player").GetComponent <Player>(); anim = gameObject.GetComponent <Animator>(); }
// Start is called before the first frame update void Start() { InitializeEquip(); gravityScal = gameObject.GetComponent <Rigidbody2D>().gravityScale; GameObject camObj = GameObject.FindGameObjectWithTag("MainCamera"); gameOverPanel = GameObject.Find("GameOverPanel"); gameOverPanel.SetActive(false); playerAnimator = gameObject.GetComponent <Animator>(); nextUltimateFire = ultimateAttackCooldown; // wait 60 secs at the beginning // set initial values for UI bars superAttackBar.SetMaxValue((int)ultimateAttackCooldown); superAttackBar.SetValue(0);//when filled up completely, the playe can cast an ultra attack healthBar.SetMaxValue(health); //set the platform we use platform = Application.platform; }