示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="actionType"></param>
        public virtual void StartAction(GameActionTypeEnum actionType)
        {
            if (CurrentAction != null && CurrentAction.Type == actionType)
            {
                CurrentAction.Start();
            }

            switch (actionType)
            {
            case GameActionTypeEnum.MAP:
                Map.SpawnEntity(this);
                break;

            case GameActionTypeEnum.SKILL_HARVEST:
            case GameActionTypeEnum.MAP_MOVEMENT:
                MovementHandler.Dispatch(WorldMessage.GAME_ACTION(actionType, Id, CurrentAction.SerializeAs_GameAction()));
                break;

            case GameActionTypeEnum.MAP_TELEPORT:
                StopAction(GameActionTypeEnum.MAP);
                StopAction(GameActionTypeEnum.MAP_TELEPORT);
                // Switch back to world context
                WorldService.Instance.AddUpdatable(this);
                break;
            }
        }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="actionType"></param>
        public override void StartAction(GameActionTypeEnum actionType)
        {
            switch (actionType)
            {
            case GameActionTypeEnum.FIGHT:
                StopAction(GameActionTypeEnum.MAP);
                break;

            case GameActionTypeEnum.FIGHT_WEAPON_USE:
            case GameActionTypeEnum.FIGHT_SPELL_LAUNCH:
                Fight.Dispatch(WorldMessage.GAME_ACTION(CurrentAction.Type, Id, CurrentAction.SerializeAs_GameAction()));
                break;

            case GameActionTypeEnum.MAP_MOVEMENT:
                if (HasGameAction(GameActionTypeEnum.FIGHT))
                {
                    if (StateManager.HasState(FighterStateEnum.STATE_STEALTH))
                    {
                        Team.Dispatch(WorldMessage.GAME_ACTION(actionType, Id, CurrentAction.SerializeAs_GameAction()));
                        return;
                    }
                }
                break;
            }

            base.StartAction(actionType);
        }