Пример #1
0
 public void StartAction(IAction action)
 {
     if (currentAction == action)
     {
         return;
     }
     currentAction?.Cancel();
     currentAction = action;
 }
Пример #2
0
        public void StartAction(IAction action)
        {
            if (m_CurrentAction == action)
            {
                return;
            }

            m_CurrentAction?.Cancel();
            m_CurrentAction = action;
        }
Пример #3
0
        public void StartAction(IAction action)
        {
            if (action == preAction)
            {
                return;
            }

            if (preAction != null && action != preAction)
            {
                preAction.Cancel();
            }
            preAction = action;
        }
Пример #4
0
    IAction currentAct;//chama açao atual

    //checa açao
    public void StartAction(IAction action)
    {
        if (currentAct == action)
        {
            return;                  //se for a mesma açao sai
        }
        else if (currentAct != null) //caso contrario e tambem nao sendo null
        {
            currentAct.Cancel();     //cancela açao
            Debug.Log("Canceling " + currentAct);
        }
        currentAct = action;//e substitui por achao nova
    }
        public void StartAction(IAction action)
        {
            if (currentAction == action)
            {
                return;
            }

            if (currentAction != null)
            {
                currentAction.Cancel();
            }
            currentAction = action;
        }
Пример #6
0
 public void StartAction(IAction action)
 {
     if (currentAction == action)
     {
         return;
     }
     if (currentAction != null)
     {
         print("cancelling previous action: " + currentAction);
         currentAction.Cancel();
     }
     currentAction = action;
 }
 public void StartAction(IAction action)
 {
     if (currentAction == action)
     {
         return;
     }
     if (currentAction != null)
     {
         // print("Cancelling: " + currentAction);
         currentAction.Cancel();
     }
     currentAction = action;
 }
Пример #8
0
        private IAction m_currentAction;    // = null

        // Start new action and cancel old action
        public void StartAction(IAction action)
        {
            // New action is the same action as old
            if (m_currentAction == action)
            {
                return;
            }

            // Cancel old action if there is one
            m_currentAction?.Cancel();    // if (currentAction != null)

            // Schedule new action
            m_currentAction = action;
        }
Пример #9
0
        public void StartAction(IAction action)
        {
            if (currentAction == action)
            {
                return;
            }

            if (currentAction != null)
            {
                currentAction.Cancel();
                //Debug.Log("Cancel" + currentAction);
            }
            currentAction = action;
        }
Пример #10
0
        public void StartAction(IAction action)
        {
            if (currentAction == action)
            {
                return;
            }

            if (currentAction != null)
            {
                currentAction.Cancel(); //Wird eine neue Aktion ausgeführt, wird die alte mit Cancel() beendet (Kein Laufen und Angreifen gleichzeitig)
            }

            currentAction = action;
        }
        public void StartAction(IAction action)
        {
            //if current action & new action is same, don't cancel anything
            if (currentAction == action)
            {
                return;
            }

            if (currentAction != null)
            {
                currentAction.Cancel();
            }
            currentAction = action;
        }
Пример #12
0
 public void CancelActionByType(string type)
 {
     for (int i = 0; i < _actions.Count; i++)
     {
         IAction act = _actions[i];
         if (act.Type == type)
         {
             act.Cancel();
         }
     }
     if (_current != null && _current.Type == type)
     {
         _current.Cancel();
     }
 }
Пример #13
0
        //Cancel the movement when combat starts, and cancel combat when movement starts
        public void StartAction(IAction action)
        {
            //If current action is happening, no need to cancel. Just keep going.
            if (currentAction == action)
            {
                return;
            }
            //If current action is not null, then cancel action.
            if (currentAction != null)
            {
                currentAction.Cancel();
            }

            currentAction = action;
        }
Пример #14
0
        /// <summary>
        /// Helps to cancel certain actions before starting another
        /// </summary>
        public void StartAction(IAction action)
        {
            //no need to cancel if this is first action
            if (m_CurrentAction == action)
            {
                return;
            }

            if (m_CurrentAction != null)
            {
                m_CurrentAction.Cancel();
                Debug.Log("Cancelling " + m_CurrentAction);
            }
            m_CurrentAction = action;
        }
Пример #15
0
        IAction m_currentAction;                      //The current action being undertaken by the character


        ///////////////////////////// PUBLIC METHODS ////////////////////////////////////////////

        //Starts a character actions
        public void StartAction(IAction action)
        {
            //Check to see if the action is already scheduled
            if (m_currentAction == action)
            {
                return;
            }

            //Check to make sure action is not null
            if (m_currentAction != null)
            {
                m_currentAction.Cancel();
            }
            m_currentAction = action;
        }
Пример #16
0
        public void StartAction(IAction action)
        {
            //if we are going to continue doing the same action then we can just exit
            if (currentAction == action)
            {
                return;
            }

            //Stop the current action and begin the new one
            if (currentAction != null)
            {
                currentAction.Cancel();
            }
            currentAction = action;
        }
Пример #17
0
        //Bir action(Saldırı, Yürüme...) yapılmak istendiğinde o an yapılan
        //action iptal edilip yenisi devreye giriyor
        public void StartAction(IAction action)
        {
            //eğer yeni gelen aksiyon eski aksiyon ile aynıysa(class bazında) birşey yapma
            if (currentAction == action)
            {
                return;
            }

            //güncel aksiyon nulldan farklıysa Aksiyonu iptal ediyoruz
            if (currentAction != null)
            {
                currentAction.Cancel();
            }
            currentAction = action;
        }
Пример #18
0
        IAction currentAction; //starts as null

        //since Cancel() belongs to IAction interface, it will have the properties of whatever class is using StartAction() at the time
        public void StartAction(IAction action) //action is the current class being called
        {
            if (currentAction == action)
            {
                return;                          //preventing same action from happening in succession
            }
            if (currentAction != null)
            {
                currentAction.Cancel();
                //for fighter.cs, target = null
                //for mover.cs, navMeshAgent.isStopped = true;
                print("canceling " + currentAction);
            }
            currentAction = action; //actually updating the action here
        }
Пример #19
0
 // StartAction occurs when determining whether to stop combat or stop movement.
 public void StartAction(IAction action)
 {
     // If the fighting target still exists or the player is still moving
     // along the nav mesh, then the action will continue.
     if (currentAction == action)
     {
         return;
     }
     // If the player is no longer fighting or moving, it will cancel the action.
     if (currentAction != null)
     {
         currentAction.Cancel();
     }
     currentAction = action;
 }
Пример #20
0
 //This function will be passed a monobehavior ex.. mover or fighter.
 //It should not know which one is actually passed, it should just do the same thing regardless
 //of which one is passed.
 public void StartAction(IAction action)
 {
     //If current action is the same as the new action do nothing.
     if (currentAction == action)
     {
         return;
     }
     //Cancel action
     if (currentAction != null)
     {
         //This cancel gets called thru the interface IAction. This way we can prevent circular dependencies.
         currentAction.Cancel();
     }
     //Set new action
     currentAction = action;
 }
Пример #21
0
 public void StartAction(IAction action)
 {
     // if there is no action we return and await next action
     if (currentAction == action)
     {
         return;
     }
     // when the action is not null we are cancelling an action. An action is only triggered when we interact with combat, that is the only time an action is cancelled.
     if (currentAction != null)
     {
         // if the mover action exists and depending where we click cancel the existing action when beginning a new one
         currentAction.Cancel();
         print("Cancelled" + currentAction);
     }
     currentAction = action;
 }
        public void StartAction(IAction action)
        {
            if (_currentAction == action) //_current action ve disardan gelen action ayni ise hic bir islem yapma demis olduk
            {
                return;
            }

            if (_currentAction != null)  //eger current action bos degilse current action'i iptal et demis olduk
            {
                _currentAction.Cancel(); //IAction icinde fighter yada Mover gelicektir burda iki arasinda bir kopru kurduk ve Cancel method'nu burda cagiriyoruz
                //Debug.Log("Cancel current actin => " + _currentAction.GetType().ToString());
            }

            _currentAction = action;
            //Debug.Log("Add new action => " + action.ToString());
        }
Пример #23
0
 public void StartAction(IAction action)
 {
     if (currentAction == action)
     {
         return;
     }
     if (currentAction != null)
     {
         // Debug.Log("Cancelling " + currentAction + " and switching to " + action);
         currentAction.Cancel();
     }
     else
     {
         Debug.Log("currentAction is null");
     }
     currentAction = action;
 }
Пример #24
0
 public bool StartAction(IAction action, bool block)
 {
     if (lastActionBlocks)
     {
         return(false);
     }
     if (currentAction != action)
     {
         if (currentAction != null)
         {
             currentAction.Cancel();
         }
         currentAction    = action;
         lastActionBlocks = block;
     }
     return(true);
 }
Пример #25
0
    public void AddAction(IAction act, bool immediately = false)
    {
        if (_current != null && !_current.Finished)
        {
            if (_current.Filter(act))
            {
                act.Cancel();
                act.Dispose();
                return;
            }
            if (_current.Replace(act))
            {
                _current.Cancel();
                _current.Dispose();
                _current = null;
            }
        }
        IAction temp = null;

        for (int i = 0; i < _actions.Count; i++)
        {
            temp = _actions[i];
            if (temp.Filter(act))
            {
                act.Cancel();
                act.Dispose();
                return;
            }
            if (temp.Replace(act))
            {
                temp.Cancel();
                temp.Dispose();
                temp        = null;
                _actions[i] = act;
            }
        }
        if (immediately)
        {
            _actions.Insert(0, act);
        }
        else
        {
            _actions.Add(act);
        }
    }
        public void StartAction(IAction action)
        {
            //if the current action is equal to the new action return (skip the rest of the code)
            if (currentAction == action)
            {
                return;
            }

            //if current action is not equal to null
            if (currentAction != null)
            {
                //print that the current action is being cancelled
                currentAction.Cancel();
            }

            //store new action into current action
            currentAction = action;
        }
Пример #27
0
        public void StartAction(IAction action)
        {
            if (currentAction == action)
            {
                return;
            }

            //if the processed action is the same as the currentaction. get outta there
            //cancel Fighter when movement starts, cancel movement went fighter starts.


            if (currentAction != null)
            {
                currentAction.Cancel();
            }



            currentAction = action;
        }
Пример #28
0
        public void StartAction(IAction action)
        {
            /*
             * We don't need to change currentAction
             * if currentAction equals to new action.
             */
            if (currentAction == action)
            {
                return;
            }

            /*
             * If we already have a action but call this methon again,
             * we need to cancel the current action,
             * then we can execute new action.
             */
            if (currentAction != null)
            {
                currentAction.Cancel();
            }

            // Change the current action
            currentAction = action;
        }