示例#1
0
 //on mobile devices I will check attack input inside private void CheckPlayerInput() for sake of performance
 private void CheckAttackInput()
 {
     if (Input.GetButton("Fire1") && Time.time > c_timeToAttack)
     {
         c_playerWeaponManager.Attack();
         c_timeToAttack = Time.time + c_attackCooldown;
     }
 }
    void AttackWhileIdle()
    {
        if (controller.isGrounded)
        {
            normalizedHorizontalSpeed = 0;
            animator.SetBool("attack", true);
            animator.SetBool("run", false);
            weaponManager.Attack();
        }

        attack = false;
    }
示例#3
0
 private void doAttack()
 {
     if (weapon != null)
     {
         //anim.SetTrigger ("Firing");
         weapon.Attack(true);
         weapon.shootingRate = maxRate;
     }
 }
示例#4
0
文件: Player.cs 项目: Lithry/Tower
 public bool Attack()
 {
     if (weapon.Attack())
     {
         anim.SetTrigger("Attack");
         return(true);
     }
     return(false);
 }
示例#5
0
    // Update is called once per frame
    void Update()
    {
        currentWeapon = weaponManager.GetCurrentWeapon();

        if (Input.GetButtonDown("Fire1"))
        {
            Attack();
            weaponManager.Attack();
        }
    }
示例#6
0
    void CheckForAttack()
    {
        if (Time.time > nextAttack)
        {
            if (inputAttack)
            {
                weaponManager.Attack();
                animState.attacking = true;
                inputAttack         = false;
            }
            else
            {
                animState.attacking = false;
            }

            nextAttack = Time.time + multiClickBuffer;
        }
    }
    public void HandleWeapons()
    {
        hitButton = input.GetButtonInput(Constants.HIT_BUTTON);
        pickup    = input.GetButtonInput(Constants.PICKUP_WEAPON);
        if (hitButton)
        {
            weaponManager.Attack();
        }
        if (pickup)
        {
            weaponManager.PickUp();
        }

        if (weaponManager.updateUI)
        {
            hudController.OnGround = weaponManager.PickupWeapon ? weaponManager.PickupWeapon.pickup : null;
        }
    }
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Q))
     {
         weaponManager.SwitchWeapon();
     }
     if (Input.GetKey(KeyCode.Space))
     {
         isHoldAttack = true;
     }
     else
     {
         weaponManager.ResetAttack();
         isHoldAttack = false;
     }
     if (isHoldAttack && canShoot)
     {
         weaponManager.Attack();
     }
 }
示例#9
0
 public void _1_Attack_Return_True_If_Exit_After_Attacking()
 {
     weapon.Build();
     target.Build(weapon, TypeOfWeapon.Fist);
     Assert.IsTrue(target.Attack());
 }