Exemple #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;
        }
        /// <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);
            }
        }
Exemple #3
0
 public override bool HandleMessage(MyMessageSystem.Telegram message)
 {
     return(m_cStateMachine.HandleMessage(message));
 }
Exemple #4
0
 public abstract bool OnMessage(GameObject gameObject, Telegram message);
Exemple #5
0
 public abstract bool HandleMessage(Telegram message);
 /// <summary>
 /// Send message to game object
 /// </summary>
 /// <param name="reciever"></param>
 /// <param name="msg"></param>
 private void Discharge(GameObject reciever, Telegram msg)
 {
 }