Exemple #1
0
    public void Shoot(int OwnerId, float speedMultiplier = 1.0f)
    {
        if (bulletInventory != null)
        {
            if (!bulletInventory.ConsumeBullet())
            {
                Reload();
                return;
            }
        }

        ps.Play();
        asGunShot.Play();

        var bullet       = Instantiate(bulletPrefab, bulletSpawnPoint.position, transform.rotation);
        var bulletScript = bullet.GetComponent <Bullet>();

        if (bulletScript != null)
        {
            bulletScript.SetOwner(OwnerId);
            bulletScript.SetSpeedMultiplier(speedMultiplier);
        }
    }