void OnTriggerEnter() { GameObject collided_obj = GetComponent <CompCollider>().GetCollidedObject(); // DAMAGE --- Enemy_BT obj = collided_obj.GetComponent <Enemy_BT>(); if (obj != null) { obj.ApplyDamage(damage); } else { CompCollider obj_col = collided_obj.GetComponent <CompCollider>(); if (obj_col != null) { obj_col.CallOnContact(); } } // DESTROY --- if (collision) { Destroy(gameObject); } }
public void Start() { align = gameObject.GetComponent <Align_Steering>(); movement = gameObject.GetComponent <Movement_Action>(); if (gameObject.GetComponent <EnemySword_BT>() != null) { bt = gameObject.GetComponent <EnemySword_BT>(); } else if (gameObject.GetComponent <EnemySpear_BT>() != null) { Debug.Log("SPEAR ENEMY!", Department.IA, Color.PINK); bt = gameObject.GetComponent <EnemySpear_BT>(); } else if (gameObject.GetComponent <EnemyShield_BT>() != null) { bt = gameObject.GetComponent <EnemyShield_BT>(); } if (bt != null) { bt.current_hp = total_hp; bt.total_hp = total_hp; bt.attack_damage = attack_damage; bt.attack_cooldown = attack_cooldown; } }
public void Update() { if (align != null) { align.SetRotationVel(vel_rotation); } if (movement != null) { movement.max_accel = vel_movement; } if (gameObject.GetComponent <EnemySword_BT>() != null) { bt = gameObject.GetComponent <EnemySword_BT>(); } else if (gameObject.GetComponent <EnemySpear_BT>() != null) { Debug.Log("SPEAR ENEMY!", Department.IA, Color.PINK); bt = gameObject.GetComponent <EnemySpear_BT>(); } else if (gameObject.GetComponent <EnemyShield_BT>() != null) { bt = gameObject.GetComponent <EnemyShield_BT>(); } if (bt != null) { bt.total_hp = total_hp; bt.attack_damage = attack_damage; bt.attack_cooldown = attack_cooldown; } else { Debug.Log("BT NULL", Department.IA, Color.PINK); } }
public override bool ActionStart() { event_to_react.start_counting = false; bt = GetComponent <EnemySword_BT>(); if (bt == null) { bt = GetComponent <EnemyShield_BT>(); } if (bt == null) { bt = GetComponent <EnemySpear_BT>(); } percep_sight = GetComponent <PerceptionSightEnemy>(); comp_anim = GetComponent <CompAnimation>(); move.GoToPlayer((uint)bt.range); interupt = false; bool ret = move.ActionStart(); return(ret); }