コード例 #1
0
    private void Fire()
    {
        if (ShotCooldown > 0)
        {
            return;
        }
        FiredShot shot = Instantiate(MinigunShotPrefab);

        shot.transform.SetPositionAndRotation(transform.position, transform.rotation);
        shot.Fire(ShotSpeed, Vector2.up);
        ShotCooldown = timeBetweenShots;
    }
コード例 #2
0
 private IEnumerator FireBurst()
 {
     InCooldown = true;
     for (int i = 0; i < shotsPerBurst; i++)
     {
         FiredShot shot = Instantiate(LaserShotPrefab);
         shot.transform.SetPositionAndRotation(transform.position, transform.rotation);
         shot.Fire(ShotSpeed, aimDirection);
         yield return(new WaitForSeconds(timeBetweenShots));
     }
     StartCoroutine(Cooldown());
     yield return(null);
 }