Example #1
0
        private void shootCharge()
        {
            var game = (GameStates.PlayableState)GameCore.GameEngine.Singleton.FindGameState(x => x is GameStates.PlayableState);

            var player = (Player)game.ActiveMap.Player;

            var   mdir       = Vector2.Normalize(player.Position - this.Position);
            var   launchPort = this.Position + mdir * (this.Radius + 5); //launch stuff from slightly in front of player
            float launchVel  = 500f + player.Velocity.Length();

            var carrier = new Bomb(launchPort, 5, 1 / 1000f, this);

            carrier.Velocity = launchVel * mdir;


            game.SpawnObject <Actor>(carrier);

            var c = new GameObjects.Devices.Charge(10, 1);

            game.SpawnObject <Device>(c);
            carrier.AddDevice(c);
        }
Example #2
0
        private void shootCharge()
        {
            var game = (GameStates.PlayableState)GameCore.GameEngine.Singleton.FindGameState(x => x is GameStates.PlayableState);

            var player = (Player)game.ActiveMap.Player;

            var mdir = Vector2.Normalize(player.Position - this.Position);
            var launchPort = this.Position + mdir * (this.Radius + 5); //launch stuff from slightly in front of player
            float launchVel = 500f + player.Velocity.Length();

            var carrier = new Bomb(launchPort, 5, this);
            carrier.Velocity = launchVel * mdir;

            game.SpawnObject<Actor>(carrier);

            var c = new GameObjects.Devices.Charge(10, 1);
            game.SpawnObject<Device>(c);
            carrier.AddDevice(c);
        }