OnMessage() 공개 메소드

public OnMessage ( GameObject, player, Hashtable, param ) : void
player GameObject,
param Hashtable,
리턴 void
예제 #1
0
파일: FSMMgr.cs 프로젝트: rouchen/UnityDemo
 public void OnMessage(GameObject player, Hashtable param)
 {
     // Check for Null reference before deleting
     if (currentState == null)
     {
         Debug.LogError("FSM ERROR: Null reference is not allowed");
     }
     currentState.OnMessage(player, param);
 }
        /// <summary>
        /// The main interface for communicating between behaviours.  Using polymorphism, we
        /// define a bunch of different messages deriving from BehaviourMessage.  Each behaviour
        /// can then check for particular upcasted messahe types, and either grab some data
        /// from it (set message) or store some data in it (get message).
        /// </summary>
        /// <param name="msg">The message being communicated to the behaviour.</param>
        public override void OnMessage(ref BehaviourMessage msg)
        {
            if (msg is SetStateMessage)
            {
                SetStateMessage temp = (SetStateMessage)msg;

                AdvanceToState(temp.mNextState_In);
            }

            // Pass the message down to the currently running state.
            mCurrentState.OnMessage(ref msg);
        }