protected void AbortCurrentAction()
        {
            if (CurrentAction != null)
            {
                if (!CurrentAction.IsComplete)
                {
                    CurrentAction.Abort();
                }

                CurrentAction = null;
            }
        }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="actionType"></param>
        /// <param name="args"></param>
        public virtual void AbortAction(GameActionTypeEnum actionType, params object[] args)
        {
            if (CurrentAction != null && CurrentAction.Type == actionType && CurrentAction.CanAbort)
            {
                if (!CurrentAction.IsFinished)
                {
                    CurrentAction.Abort(args);
                }
                if (CurrentAction != null && CurrentAction.Type == actionType)
                {
                    CurrentAction = null;
                }
            }

            switch (actionType)
            {
            case GameActionTypeEnum.MAP:
                Map?.DestroyEntity(this);
                break;
            }
        }