예제 #1
0
    void FireGun()
    {
        if (Input.GetButton("Fire1"))
        {
            if (fireRateTimer <= 0f)
            {
                //Debug.Log("Fire!");
                GameObject bullet = Instantiate(gunProperties.GetBulletPrefab(), gunProperties.GetBulletTransform().position, gunProperties.GetBulletTransform().rotation, gunProperties.GetBulletsInHierarchyTransform());
                fireRateTimer = gunProperties.GetFireRate();
                shootAudio.Play();
            }
        }

        fireRateTimer -= Time.deltaTime;
    }
예제 #2
0
 public Vector3 GetFireDirection()
 {
     return((gunProperties.GetBulletTransform().position - fireDirectionPoint).normalized);
 }