Example #1
0
        // -------------------------------------------

        /*
         * Manager of global events
         */
        private void OnNetworkEvent(string _nameEvent, bool _isLocalEvent, int _networkOriginID, int _networkTargetID, params object[] _list)
        {
            if (_nameEvent == NetworkEventController.EVENT_WORLDOBJECTCONTROLLER_LOCAL_CREATION_CONFIRMATION)
            {
                if (this.gameObject.GetComponent <ActorNetwork>().NetworkID.GetID() == (string)_list[0])
                {
                    if (LocalPlayerController.Instance.AvatarPlayer == null)
                    {
                        LocalPlayerController.Instance.AvatarPlayer = this.gameObject;
                    }
                }
            }
            if (_nameEvent == EVENT_PLAYER_NEW_ANIMATION)
            {
                if (NetworkID.CheckID((string)_list[0]))
                {
                    base.ChangeAnimation(int.Parse((string)_list[1]), true);
                }
            }
            if (_nameEvent == EVENT_PLAYER_NEW_STATE)
            {
                if (NetworkID.CheckID((string)_list[0]))
                {
                    base.ChangeState(int.Parse((string)_list[1]));
                }
            }
        }
        // -------------------------------------------

        /*
         * Manager of global events
         */
        private void OnNetworkEvent(string _nameEvent, bool _isLocalEvent, int _networkOriginID, int _networkTargetID, params object[] _list)
        {
            if (GameEventController.Instance.IsGameMaster())
            {
                return;
            }
            if (this.gameObject == null)
            {
                return;
            }

            if (_nameEvent == EVENT_ENEMY_NEW_STATE)
            {
                if (NetworkID.CheckID((string)_list[0]))
                {
                    base.ChangeState(int.Parse((string)_list[1]));
                }
            }
            if (_nameEvent == EVENT_ENEMY_LIFE_UPDATED)
            {
                if (NetworkID.CheckID((string)_list[0]))
                {
                    SetLife(int.Parse((string)_list[1]));
                }
            }
            if (_nameEvent == EVENT_ENEMY_NEW_ANIMATION)
            {
                if (NetworkID.CheckID((string)_list[0]))
                {
                    base.ChangeAnimation(int.Parse((string)_list[1]), bool.Parse((string)_list[2]));
                }
            }
        }