コード例 #1
0
        public void SwitchAction(string actionName, string pendingActionName)
        {
            if (CurrentAction != null)
            {
                CurrentAction.OnDeactivate();
                CurrentAction.DisconnectInputs();
            }


            CurrentAction = ModifierContainer.Get(actionName);
            PendingAction = ModifierContainer.Get(pendingActionName);
            CurrentAction.Setup();
            CurrentAction.OnActivate();

            if (OnSwitchAction != null)
            {
                OnSwitchAction();
            }
        }
コード例 #2
0
        public void SwitchAction(string actionName)
        {
            //if (PendingAction != null)
            //{
            //    PendingAction.OnDeactivate();
            //    PendingAction.DisconnectInputs();
            //}
            if (CurrentAction != null)
            {
                CurrentAction.OnDeactivate();
                CurrentAction.DisconnectInputs();
            }

            CurrentAction = ModifierContainer.Get(actionName);
            CurrentAction.Setup();
            CurrentAction.OnActivate();

            if (OnSwitchAction != null)
            {
                OnSwitchAction();
            }
            if (actionName == ModifierNames.None && PendingAction != null && PendingAction.Name != ModifierNames.None)
            {
                if (CurrentAction != null)
                {
                    CurrentAction.OnDeactivate();
                    CurrentAction.DisconnectInputs();
                }
                PendingAction.Setup();
                PendingAction.OnActivate();

                if (OnSwitchAction != null)
                {
                    OnSwitchAction();
                }
                PendingAction = ModifierContainer.Get(ModifierNames.None);
                //return;
            }
        }