private void OnTriggerEnter2D(Collider2D collision) { Boss01Controller boss01 = collision.gameObject.GetComponent <Boss01Controller>(); if (boss01 != null) { boss01.ChangeHealth(-Atk); } EnemyController slime = collision.gameObject.GetComponent <EnemyController>(); if (slime != null) { slime.ChangeHealth(-Atk); } Boss02Controller boss02 = collision.gameObject.GetComponent <Boss02Controller>(); if (boss02 != null) { boss02.ChangeHealth(-Atk); } BossBody bossBody = collision.gameObject.GetComponent <BossBody>(); if (bossBody != null) { bossBody.ChangeHealth(-Atk); } Boss03Controller boss03 = collision.gameObject.GetComponent <Boss03Controller>(); if (boss03 != null) { boss03.ChangeHealth(-Atk); } }
// Use this for initialization void Start() { hero = GameObject.Find("hero").GetComponent <HeroBody>(); bossBody = GetComponent <BossBody>(); canAttack = true; canShoot = true; waypoints = GetComponent <BossWaypoints>(); }
public void Awake() { Body = GetComponent <BossBody>(); }