예제 #1
0
        public bool HandleMessage(Telegram message)
        {
            if(m_cCurrentState != null)
            {
                if(m_cCurrentState.OnMessage(m_cOwner, message))
                {
                    return true;
                }
            }

            if (m_cGlobalState != null)
            {
                if (m_cGlobalState.OnMessage(m_cOwner, message))
                {
                    return true;
                }
            }

            return false;
        }
예제 #2
0
        /// <summary>
        /// Send a message to specific object by receiverid
        /// </summary>
        /// <param name="delay">Time delay  (milisecond)</param>
        /// <param name="senderid">Send ID</param>
        /// <param name="receiverid">Receiver ID</param>
        /// <param name="message">Message Code</param>
        /// <param name="ExtraInfo">More Infor</param>
        public void DispatchMessage(int delay, int senderid, int receiverid, int message, GameObject ExtraInfo)
        {
            Telegram _message = new Telegram();
            _message.DispatchTime = delay;
            _message.ExtraInfo = ExtraInfo;
            _message.Msg = message;
            _message.RecieverID = receiverid;
            _message.SenderID = senderid;

            // if delay <= 0 then we send message immediately
            if (delay <= 0)
            {
                GameObject pReceiver = MyEntityManager.Instance().GetGameObjectFromID(receiverid);
                Discharge(pReceiver, _message);
            }
            else
            {
                m_hMessages.Add(_message);
            }
        }
예제 #3
0
 public override bool HandleMessage(MyMessageSystem.Telegram message)
 {
     return(m_cStateMachine.HandleMessage(message));
 }
예제 #4
0
파일: MyState.cs 프로젝트: hieuntp2/MyGraph
 public abstract bool OnMessage(GameObject gameObject, Telegram message);
예제 #5
0
 public abstract bool HandleMessage(Telegram message);
예제 #6
0
 /// <summary>
 /// Send message to game object
 /// </summary>
 /// <param name="reciever"></param>
 /// <param name="msg"></param>
 private void Discharge(GameObject reciever, Telegram msg)
 {
 }