void OnTriggerEnter(Collider c) { Vector3 pos = c.GetComponent <Transform>().position; summon.transform.position = pos + new Vector3(0, 1, 0); Damage aratk = GameObject.Find("Damage").GetComponent <Damage>(); if (c.gameObject == aboss) { summon.gameObject.SetActive(true); summon.Play(); GameObject.Find("long_damage_sound").GetComponent <AudioSource>().Play(); boxman Boss = GameObject.Find("boxman").GetComponent <boxman>(); Destroy(gameObject); for (int i = 0; i < 2; i++) { Boss.hp--; } } if (c.gameObject == bboss) { summon.gameObject.SetActive(true); summon.Play(); GameObject.Find("long_damage_sound").GetComponent <AudioSource>().Play(); boxman2 bBoss = GameObject.Find("BOXMAN2").GetComponent <boxman2>(); Destroy(gameObject); bBoss.hp = bBoss.hp - 10; } if (c.gameObject == cboss) { summon.gameObject.SetActive(true); summon.Play(); GameObject.Find("long_damage_sound").GetComponent <AudioSource>().Play(); goblin cBoss = GameObject.Find("Goblin").GetComponent <goblin>(); Destroy(gameObject); cBoss.hp = cBoss.hp - 10; } Destroy(gameObject, 0.3f); }
// Update is called once per frame void Update() { boxman2 Boss = GameObject.Find("BOXMAN2").GetComponent <boxman2>(); Hpbar.fillAmount = Boss.hp / 10f; }