private void Update() { if (!_initialization && GameNetworkManager.Instance != null) { this._initialization = true; GameNetworkManager.Instance.MessageReceived += OnMessageReceived; GameNetworkManager.Instance.ErrorRaised += OnErrorRaised; } if (_item == MailboxItems.Screeen) { _fsm.Fsm.Event("ScreenSentByHL"); ScreenFSM.Fsm.Event("ScreenSentByHL"); _item = MailboxItems.None; } if (_item == MailboxItems.UsbKey) { _fsm.Fsm.Event("Usb1SentByHL"); Usb1FSM.Fsm.Event("Usb1SentByHL"); _item = MailboxItems.None; } if (_item == MailboxItems.DoorHandle) { _fsm.Fsm.Event("DoorKeySentByHL"); DoorKeyFSM.Fsm.Event("DoorKeySentByHL"); _item = MailboxItems.None; } }
private void OnMessageReceived(object sender, GameNetworkMessageArgs e) { if (GameNetworkParser.FindType(e.Message) == GameMessageTypes.SendObjectInMailbox) { _item = GameNetworkParser.DecodeSendObjectInMailbox(e.Message); } }
/// <summary> /// Génère un message pour le passage d'objet dans la boit aux lettres /// </summary> /// <param name="item">Objet a passer</param> /// <returns>Message construit</returns> public static string CreateMessageSendObjectInMailbox(MailboxItems item) { if (item == MailboxItems.None) { return(string.Empty); } return(string.Format("{0}|{1}", (int)GameMessageTypes.SendObjectInMailbox, (int)item)); }
void Start() { _fsm = GetComponent <PlayMakerFSM>(); _initialization = false; _item = MailboxItems.None; }