Modification start date
[BattleCats.git] / Assets / BossSceneStarter.cs
blob2a9d0c97f088f692a03bb795ccf3d45713b489be
1 using System.Collections;
2 using System.Collections.Generic;
3 using UnityEngine;
4 using UnityEngine.UI;
6 public class BossSceneStarter : MonoBehaviour {
8 private Transform yarn;
9 private BossMovement boss;
10 private BossController bossController;
11 private GameObject gridOpen;
12 private GameObject gridClosed;
13 [SerializeField]
14 private GameObject m_HealthSlider;
15 [SerializeField]
16 private GameObject m_HealthSliderText;
18 private bool update;
19 private bool once;
21 // Use this for initialization
22 void Start () {
23 yarn = GameObject.FindGameObjectWithTag ("YarnPhysics").GetComponent<Transform>();
24 boss = GameObject.FindGameObjectWithTag ("TanukiSensei").GetComponent<BossMovement>();
25 bossController = GameObject.FindGameObjectWithTag ("TanukiSensei").GetComponent<BossController>();
26 gridOpen = GameObject.FindGameObjectWithTag ("BossGridOpen");
27 gridClosed = GameObject.FindGameObjectWithTag ("BossGridClosed");
28 gridClosed.SetActive (false);
29 m_HealthSlider.SetActive (false);
30 m_HealthSliderText.SetActive (false);
32 update = true;
33 once = true;
36 // Update is called once per frame
37 void Update () {
38 if (update) {
39 if (yarn.position.x > -30f && once)
41 gridClosed.SetActive (true);
42 gridOpen.SetActive (false);
43 m_HealthSlider.SetActive (true);
44 m_HealthSliderText.SetActive (true);
45 once = false;
48 if (yarn.position.x > -19.7) {
49 boss.hoverPath = true;
50 bossController.automated = true;
51 update = false;