Ejemplo n.º 1
0
    private void ShootMain(MouseInput leftButton)
    {
        if (leftButton.down)
        {
            _charAnim.EnableAim(weaponGetSpeed, delegate { isShootMain = true; });
        }
        if (leftButton.up)
        {
            _charAnim.DisableAim(weaponGetSpeed);
            isShootMain = false;
        }

        if (leftButton.press && (isShootMain || isShootExtra))
        {
            _weaponShooter.Shoot();
            if (_character.isPlayer)
            {
                UIController.instance.UpdateAmmoUI(_weaponShooter.CurrentAmmoInStore, _weaponShooter.CurrentAmmoAmmount);
            }
            if (_weaponShooter.IsStoreEmpty && _weaponShooter.CurrentAmmoAmmount > 0)
            {
                UIController.instance.ShowAmmoHint();
            }
        }
    }
Ejemplo n.º 2
0
 void weaponshoot()
 {
     if ((Input.GetKey(KeyCode.Space) || OVRInput.Get(OVRInput.Button.PrimaryIndexTrigger, OVRInput.Controller.LTouch)) && leftWeapon)
     {
         leftWeapon.Shoot();
     }
     if ((Input.GetKey(KeyCode.Space) || OVRInput.Get(OVRInput.Button.PrimaryIndexTrigger, OVRInput.Controller.RTouch)) && rightWeapon)
     {
         rightWeapon.Shoot();
     }
 }
Ejemplo n.º 3
0
 private void OnTriggerStay(Collider other)
 {
     if (isDead)
     {
         return;
     }
     //Debug.Log(other.gameObject.name);
     if (other.tag == "Player")
     {
         shooting           = true;
         transform.rotation = Quaternion.LookRotation(other.transform.position - transform.position);
         weapon.Shoot();
     }
 }