コード例 #1
0
 protected void OnAttackPressed()
 {
     if (MovementModel == null || MovementView == null)
     {
         return;
     }
     if (MovementModel.CanAttack())
     {
         MovementModel.DoAttack();
         MovementView.DoAttack();
     }
 }
コード例 #2
0
    protected void OnAttackPressed()
    {
        if (m_MovementModel == null)
        {
            return;
        }

        if (m_MovementModel.CanAttack() == false)
        {
            return;
        }

        m_MovementModel.DoAttack();
        m_MovementView.DoAttack();
    }
コード例 #3
0
    protected void OnAttackPressed() //When a player tries to attack
    {
        //Make sure we can both attack, and that the system is initialized
        if (m_MovementModel == null)
        {
            return;
        }
        if (m_MovementModel.CanAttack() == false)
        {
            return;
        }

        //Do the attack
        m_MovementModel.DoAttack();
        m_MovementView.DoAttack();
    }
    protected void OnAttackPressed() //This can be called from the CharacterMovementKeyboardControl
    //Do combos within the animations so in the MovementView
    {
        if (m_MovementModel == null)
        {
            return;
        }

        if (m_MovementModel.CanAttack() == false) //This check makes sure that you can attack. According to the MovementModel, you cannot attack if you are already attacking. Whether you are attacking or not is decided by the animator.
        {
            return;                               //remember that the return takes the code out of the OnAttackPressed() and that the following calls wont occur if then, the canattack is false.
        }

        m_MovementModel.DoAttack(); //Which will do no more than send a debug message atm
        m_MovementView.DoAttack();  //Which should trigger the animation. I think its in the animations you should do the combos
    }