Beispiel #1
0
 //End an override behaviour.
 public void KillOverrideBehaviour()
 {
     if (usingOverrideBehaviour)
     {
         //KillBehaviour automatically calls OnEndBehaviour
         currentBehaviour.KillBehaviour();
     }
 }
Beispiel #2
0
        //Kill AI///////////////////////////////////////////////////////////
        public void KillAI()
        {
            //Check if we can actually do this, to stop errors in wierd edge cases
            if (this.enabled)
            {
                if (combatBehaviour)
                {
                    combatBehaviour.KillBehaviour();
                }
                if (idleBehaviour)
                {
                    idleBehaviour.KillBehaviour();
                }

                //Call method on other scripts on this object, in case extra stuff needs to be done when the AI dies.
                gameObject.SendMessage("OnAIDeath", SendMessageOptions.DontRequireReceiver);
                //GameObject.Destroy(gameObject, timeUntilBodyIsDestroyedAfterDeath);
                GameObject.Destroy(gameObject);
            }
        }