コード例 #1
0
ファイル: BaseScript.cs プロジェクト: khoai1234/190315
 //End an override behaviour.
 public void KillOverrideBehaviour()
 {
     if (usingOverrideBehaviour)
     {
         //KillBehaviour automatically calls OnEndBehaviour
         currentBehaviour.KillBehaviour();
     }
 }
コード例 #2
0
ファイル: BaseScript.cs プロジェクト: khoai1234/190315
        //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(animationScript.myAIBodyTransform.gameObject, timeUntilBodyIsDestroyedAfterDeath);
                GameObject.Destroy(gameObject);
            }
        }