private void CheckIfDoubleJump()
 {
     if (upgrades.HasUpgrade(Upgrade.UpgradeType.DoubleJump))
     {
         timesJumped++;
     }
     else
     {
         //maximum jumps
         timesJumped = 2;
     }
 }
Пример #2
0
 private void HandleMeditation()
 {
     if (upgrades.HasUpgrade(Upgrade.UpgradeType.Meditation))
     {
         if (Input.GetKey(KeyCode.T))
         {
             if (!isMeditating && _animator.GetCurrentAnimatorStateInfo(0).IsName("Idle") && charge.GetCharge() > 0)
             {
                 StartCoroutine(Meditation());
             }
         }
         else if (isMeditating)
         {
             SetMeditation(false);
         }
     }
 }
Пример #3
0
    private void HandleAttackInput()
    {
        if (Time.time >= nextAttackTime)
        {
            if (Input.GetKeyDown(KeyCode.W))
            {
                if (_animator.GetCurrentAnimatorStateInfo(0).IsName("Idle") && upgrades.HasUpgrade(Upgrade.UpgradeType.FireFist))
                {
                    nextAttackTime    = Time.time + 1f / attackRate;
                    chargeBeforePunch = charge.GetCharge();
                    punchCoroutine    = WaitForPunchTime();
                    StartFirePunch();
                }
                else
                {
                    int a = UnityEngine.Random.Range(0, 2);
                    if (a == 0)
                    {
                        Attack("punch");
                    }
                    else
                    {
                        Attack("kick");
                    }
                    nextAttackTime = Time.time + 1f / attackRate;
                }
            }
        }
        if (Input.GetKeyUp(KeyCode.W) && chargingFist)
        {
            DisruptFirePunch();
        }

        if (Input.anyKeyDown && !Input.GetKeyDown(KeyCode.W) && chargingFist)
        {
            //just stops the charging if any other key is pressed without dealing damage
            DisruptFirePunch(false);
        }
    }