summaryrefslogtreecommitdiff
path: root/Assets/Scripts/BossFighthandlerScript.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Assets/Scripts/BossFighthandlerScript.cs')
-rwxr-xr-xAssets/Scripts/BossFighthandlerScript.cs75
1 files changed, 75 insertions, 0 deletions
diff --git a/Assets/Scripts/BossFighthandlerScript.cs b/Assets/Scripts/BossFighthandlerScript.cs
new file mode 100755
index 0000000..b95095b
--- /dev/null
+++ b/Assets/Scripts/BossFighthandlerScript.cs
@@ -0,0 +1,75 @@
+using UnityEngine;
+using System.Collections;
+
+public class BossFighthandlerScript : MonoBehaviour {
+
+ public GameObject Boundry;
+ public GameObject Boss1;
+ public BossCameraScript BossCamera;
+ DialogueScript dialogueScript;
+ public GameObject DestroyAnimation;
+
+ // only trigger for once
+ bool triggered;
+
+ // Use this for initialization
+ void Start ()
+ {
+ dialogueScript = GameObject.FindGameObjectWithTag("DialogueSystem").GetComponent<DialogueScript>();
+ }
+
+ // Update is called once per frame
+ void Update ()
+ {
+
+ }
+
+ private void OnTriggerEnter2D(Collider2D collision)
+ {
+ if (collision.tag == "PlayerCollider" && !triggered)
+ {
+ triggered = true;
+ StartCoroutine(start());
+ }
+ }
+
+ IEnumerator start()
+ {
+ Boundry.gameObject.SetActive(true);
+ BossCamera.EnableBossCamera();
+ yield return new WaitForSeconds(2);
+ Boss1.SetActive(true);
+ yield return new WaitForSeconds(.5f);
+ dialogueScript.ShowDialogue("You'll have to kill me to go beyond this point");
+ dialogueScript.FromBoss1 = true;
+ }
+
+
+ // Wait for Dialogue Panel to be dismissed
+ public void StartBossFight()
+ {
+ Boss1.GetComponent<Boss1MovementSCript>().EnableBoss1Movement();
+ Boss1.GetComponentInChildren<Boss1FireScript>().EnableBoss1Fire();
+ }
+
+
+ // Called by Boss1HealthScript
+ public void EndBossFight()
+ {
+ var animation = Instantiate(DestroyAnimation, Boss1.transform.position, Quaternion.identity);
+ Boss1.GetComponent<Boss1MovementSCript>().DisableBoss1Movement();
+ Boss1.GetComponentInChildren<Boss1FireScript>().DisableBoss1Fire();
+ Boss1.GetComponentInChildren<Boss1AttackScript>().DisableBoss1Attack();
+ Destroy(animation, 4f);
+ Destroy(Boss1, 4f);
+ StartCoroutine(end());
+ }
+ IEnumerator end()
+ {
+ yield return new WaitForSeconds(3);
+ BossCamera.DisableBossCamera();
+ Boundry.gameObject.SetActive(false);
+ }
+
+
+}