Beispiel #1
0
    private void Shoot()
    {
        // Start timer/cooldown
        firingTimer.Start();

        // Play firing effects once
        //((Particles)gunParticles).Emitting = true;

        // Play firing sound
        firingSound.Play();

        // Spawn new bullet instance
        Node b = bullet.Instance();

        // Set current position and the direction it should travel
        ((Player_Bullet)b).SetPosAndHeading(firingPosition.GetGlobalTransform().origin, -aim[2].Normalized());
        // Set parent
        ((Player_Bullet)b).Parent = this;
        // Add it to the bullet container
        bulletContainer.AddChild(b);

        ammo--;
    }