void OnTriggerEnter2D(Collider2D other) { Debug.Log(other); boss2 l1Boss = other.GetComponent <boss2>(); // Do something // Destroy(gameObject); if (l1Boss != null) { Instantiate(effect, transform.position, transform.rotation); bossHealth = l1Boss.TakeDamage(damage); bossHealthTxt.text = "Boss : " + bossHealth.ToString(); } }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Escape) || Input.GetButtonDown("Start")) { if (!GameManager.Instance.game_paused) { musicInstance.setPaused(false); } else if (GameManager.Instance.game_paused) { musicInstance.setPaused(true); } } if (latestBeat != beat) { CameraShaker.Instance.ShakeOnce(1f, 1f, .1f, .1f); latestBeat = beat; markerOnEvent.Invoke(); } if (latestBar != bar) { //Debug.Log("Bar changed to: "+latestBar); latestBar = bar; barEvent.Invoke(); } if (GameObject.Find("Boss1") != null) //set boss at Start, then set FMOD param { boss1Script = GameObject.Find("Boss1").GetComponent <boosAnimationScript>(); musicInstance.setParameterByName("Boss Health", boss1Script.boss1Health); //print(boss1Script.boss1Health); } else if (GameObject.Find("Boss2") != null) //set boss at Start, then set FMOD param { boss2script = GameObject.Find("Boss2").GetComponent <boss2>(); musicInstance.setParameterByName("CEQ_Low", (boss2script.low1 + boss2script.low2) / 2); musicInstance.setParameterByName("CEQ_Mid", (boss2script.mid1 + boss2script.mid2) / 2); musicInstance.setParameterByName("CEQ_High", (boss2script.high1 + boss2script.high2) / 2); } musicInstance.setParameterByName("Player Health", (float)GameManager.Instance.minPlayerHP); }
// Start is called before the first frame update void Start() { con = GameObject.Find("player").GetComponent <controller>(); animator = GetComponent <Animator>(); boss2copy = GameObject.Find("boss2").GetComponent <boss2>(); }