public override void Act(GameObject player, GameObject npc) { // get mothership MothershipBoss mothership = npc.GetComponent <MothershipBoss>(); if (mothership) { // control the move mothership.move(1); // Use weapons if (Time.time >= mothership.NextFireTime) { // Set cooldown float cooldown = 5f; mothership.NextFireTime = Time.time + cooldown; // Release droid if (npc.transform.position.z <= mothership.posZ.max - 2) { mothership.releaseDroid(); mothership.releaseDroid(); } // Side bubble red mothership.weapons[0].fire(); mothership.weapons[1].fire(); } } else { Debug.LogWarning("This state can only handle Mothership."); } }
public override void Reason(GameObject player, GameObject npc) { // get mothership MothershipBoss mothership = npc.GetComponent <MothershipBoss>(); if (mothership) { // drop to low health float hpProportion = (float)mothership.health / mothership.maxHealth; if (hpProportion < 0.25f) { mothership.SetTransition(FSMSystem.Transition.LowHealth); } } else { Debug.LogWarning("This state can only handle Mothership."); } }