Exemple #1
0
    void TryAttack()
    {
        bool isLightAttack = RBInput.GetButtonDownForPlayer(InputStrings.FIRE, PlayerIndex);

        if (isLightAttack)
        {
            fighter.AttackWithWeapon(Fighter.AttackType.Weak);
        }
        bool isLightReleased = RBInput.GetButtonUpForPlayer(InputStrings.FIRE, PlayerIndex);

        if (isLightReleased)
        {
            fighter.ReleaseWeapon();
        }
        bool isHeavyAttack = RBInput.GetButtonDownForPlayer(InputStrings.FIRE2, PlayerIndex);

        if (isHeavyAttack)
        {
            fighter.AttackWithWeapon(Fighter.AttackType.Strong);
        }
        bool isHeavyReleased = RBInput.GetButtonUpForPlayer(InputStrings.FIRE2, PlayerIndex);

        if (isHeavyReleased)
        {
            fighter.ReleaseWeapon();
        }
    }
 /*
  * Set fighter to blocking or unblocking depending on button up or down.
  */
 void TryBlock()
 {
     if (RBInput.GetAxisForPlayer(InputStrings.BLOCK, PlayerIndex, playerDevice) == 1 ||
         RBInput.GetButtonForPlayer(InputStrings.BLOCK, PlayerIndex, playerDevice))
     {
         fighter.Block();
     }
     else if (RBInput.GetAxisForPlayer(InputStrings.BLOCK, PlayerIndex, playerDevice) == 0 ||
              RBInput.GetButtonUpForPlayer(InputStrings.BLOCK, PlayerIndex, playerDevice))
     {
         if (fighter.IsBlocking)
         {
             fighter.UnBlock();
         }
     }
 }
Exemple #3
0
 /*
  * Set fighter to blocking or unblocking depending on button up or down.
  */
 void TryBlock()
 {
     if (RBInput.GetAxisForPlayer(InputStrings.BLOCK, PlayerIndex) == 1 ||
         RBInput.GetButtonForPlayer(InputStrings.BLOCK, PlayerIndex))
     {
         fighter.Block();
     }
     else if (RBInput.GetAxisForPlayer(InputStrings.BLOCK, PlayerIndex) < 1 ||
              RBInput.GetButtonUpForPlayer(InputStrings.BLOCK, PlayerIndex))
     {
         if (fighter.isBlocking)
         {
             fighter.UnBlock(false);
         }
     }
 }