コード例 #1
0
 void Update()
 {
     if (_canMove)
     {
         if ((Input.GetAxis($"Fire1_{PlayerId}") > 0))
         {
             shootable.Shoot();
         }
     }
 }
コード例 #2
0
 protected override void Fire1Release()
 {
     charging = false;
     if (chargeSize > chargeThreshold)
     {
         Debug.Log($"[TouretteModule] Release Charge: Size {chargeSize}");
         shootable.Shoot(chargeSize, (chargeSize / maximumCharge) / (maximumCharge / chargeSize));
     }
     chargeSize = 0;
 }
コード例 #3
0
    void Shoot()
    {
        //make sure that the prefab orientation is preserved
        Quaternion ammoRotation = baseAmmoRotation;
        Shootable  shot         = (Shootable)Instantiate(loadedAmmo, transform.position, ammoRotation);

        //shoot in the direction the weapon is facing
        shot.Shoot(Vector3.Normalize(transform.forward));
        ammoStorage.ConsumeAmmo(loadedAmmo.ammoType, 1);

        //play shooting sound
        if (PlayerPrefs.GetInt(PlayerPrefKeys.MUTE) != 1)
        {
            audio.Play();
        }
    }
コード例 #4
0
 public void Fire(Transform owner, Transform position, IDamager damager)
 {
     Shootable.Shoot(owner, position, damager, projectileSpeed);
 }
コード例 #5
0
 protected override void Fire1Press()
 {
     Debug.Log("[TurretModule] Shoot");
     shootable.Shoot();
 }