public void decide(Entity me, GameState environment, float timedelta, GameStateStack states) { time -= timedelta; if (time < 0) { respawn(environment); me.CombatStats.Health = -1; } }
public void decide(Entity me, GameState environment, float timedelta, GameStateStack states) { me.Physics.Velocity = environment.gameObjective().Physics.Position - me.Physics.Position; foreach (Entity player in environment.Players) { if ((player.Physics.Position - me.Physics.Position).LengthSquared() < 90000) { me.Physics.Velocity = player.Physics.Position - me.Physics.Position; } } }
public void decide(Entity me, GameState environment, float timedelta, GameStateStack states) { if (me.CombatStats.CurrentCooldown <= 0) { // Find closest player and shoot, if in range me.CombatStats.CurrentCooldown = me.CombatStats.Cooldown; } Vector2 direction = me.Physics.Position - environment.gameObjective().Physics.Position; direction.Normalize(); me.Physics.Velocity = direction; }
public override void decide(Entity me, GameState environment, float timedelta, GameStateStack states) { // Copy players speed, then add our own delta // HACK: We duplicate the players motion here, then add our own. Not pretty. me.Physics.Position += me.Source.Physics.Velocity * me.Source.Physics.Speed * timedelta; Vector2 delta = me.Physics.Position - me.Source.Physics.Position; if (delta.LengthSquared() < maxDelta * maxDelta) me.Physics.Velocity = new Vector2(1, -1) * GamePad.GetState(control).ThumbSticks.Right; else me.Physics.Velocity = -delta; }
public void decide(Entity me, GameState environment, float timedelta, GameStateStack states) { Start -= timedelta; End -= timedelta; if (Start < 0 && !triggered) { triggered = true; foreach (IAbility ability in me.Abilities) ability.levelUp(); } if (End < 0) me.CombatStats.Health = -1; }
public override void decide(Entity me, GameState environment, float timedelta, GameStateStack states) { // Verify connection status GamePadState controller = GamePad.GetState(control); if (!controller.IsConnected) { pauseDisconnect(states); // May want to remember which player that paused game return; } setHeading(me, controller); // Pause menu: if (Controller.RecentlyPressed(control, Buttons.Start, 0.5f)) pauseDisconnect(states); if (Controller.RecentlyPressed(control, Buttons.Back, 0.5f)) states.pop(); }
public void decide(Entity me, GameState environment, float timedelta, GameStateStack states) { Start -= timedelta; End -= timedelta; if (Start < 0 && !triggered) { triggered = true; foreach (IAbility ability in me.Abilities) { ability.levelUp(); } } if (End < 0) { me.CombatStats.Health = -1; } }
// Initializes the game manager. public void Initialize(GameBase gameBase) { this.gameBase = gameBase; elapsedTicks = 0; FormatCodes.Initialize(); Controls.Initialize(); ScreenResized(); AudioSystem.MasterVolume = 0.1f; // Begin the game state stack with a RoomControl. gameStateStack = new GameStateStack(new StateDummy()); gameStateStack.Begin(this); gameControl = new GameControl(this); gameControl.StartGame(); }
public void decide(Entity me, GameState environment, float timedelta, GameStateStack states) { if (me.CombatStats.CurrentCooldown <= 0) { Entity newCreep = new Entity(); // This should be done by some factory or other // Alternatively, make sure that actual copying is taking place newCreep.Physics.Position = me.Physics.Position; newCreep.Behaviour = Prototype.Behaviour; newCreep.CollisionHandler = Prototype.CollisionHandler; newCreep.Renderable = Prototype.Renderable; newCreep.Source = me; newCreep.Status = Prototype.Status; newCreep.Collidable = Prototype.Collidable; newCreep.CombatStats = Prototype.CombatStats; me.CombatStats.CurrentCooldown = me.CombatStats.Cooldown; environment.addGameObject(newCreep); } }
public override void decide(Entity me, GameState environment, float timedelta, GameStateStack states) { // Verify connection status GamePadState controller = GamePad.GetState(control); if (!controller.IsConnected) { pauseDisconnect(states); // May want to remember which player that paused game return; } setHeading(me, controller); // Pause menu: if (Controller.RecentlyPressed(control, Buttons.Start, 0.5f)) { pauseDisconnect(states); } if (Controller.RecentlyPressed(control, Buttons.Back, 0.5f)) { states.pop(); } }
public virtual void decide(Entity me, GameState environment, float timedelta, GameStateStack states) { }
public WinMenu(GameStateStack stack) { this.stack = stack; }
public LoseMenu(GameStateStack stack) { this.stack = stack; }
public override void decide(Entity me, GameState environment, float timedelta, GameStateStack states) { // Copy players speed, then add our own delta // HACK: We duplicate the players motion here, then add our own. Not pretty. me.Physics.Position += me.Source.Physics.Velocity * me.Source.Physics.Speed * timedelta; Vector2 delta = me.Physics.Position - me.Source.Physics.Position; if (delta.LengthSquared() < maxDelta * maxDelta) { me.Physics.Velocity = new Vector2(1, -1) * GamePad.GetState(control).ThumbSticks.Right; } else { me.Physics.Velocity = -delta; } }
public MainMenu(GameStateStack gameStateStack) : base(gameStateStack) { // NOP }
public void pauseDisconnect(GameStateStack states) { states.push(new PauseMenu(states, control)); }