Ejemplo n.º 1
0
 public override void _Ready()
 {
     age          = 0;
     exploded     = false;
     bulletParent = (Position3D)GetParent();
     explosion    = bulletParent.GetNode <MeshInstance>("Explosion");
 }
Ejemplo n.º 2
0
    private void Explode()
    {
        if (!exploded)
        {
            explosionTime     = age;
            exploded          = true;
            explosion.Visible = true;

            var sound = bulletParent.GetNode <AudioStreamPlayer3D>("ExplosionNoise");
            sound.Play();
        }
    }
Ejemplo n.º 3
0
    private void ShootVaguelyTowards(Vector3 where)
    {
        var target = where;

        target.x += (float)(inaccuracyMax * rng.NextDouble());
        target.x -= (float)(inaccuracyMax * rng.NextDouble());
        target.z += (float)(inaccuracyMax * rng.NextDouble());
        target.z -= (float)(inaccuracyMax * rng.NextDouble());

        Position3D bullet = (Position3D)bulletScene.Instance();

        bullet.LookAtFromPosition(
            this.Translation,
            target,
            Vector3.Up
            );

        var newBulletPhysics = bullet.GetNode <PhysicsBody>("BulletPhysics");

        newBulletPhysics.SetCollisionLayerBit(2, true);

        world.AddChild(bullet);
    }