コード例 #1
0
ファイル: Enemy.cs プロジェクト: Kartoffelsaft/Shoots
    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);
    }