예제 #1
0
 public void decide(Entity me, GameState environment, float timedelta, GameStateStack states)
 {
     time -= timedelta;
     if (time < 0)
     {
         respawn(environment);
         me.CombatStats.Health = -1;
     }
 }
예제 #2
0
 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;
         }
     }
 }
예제 #3
0
        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;
        }
예제 #4
0
        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;
        }
예제 #5
0
 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;
 }
예제 #6
0
        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;
        }
예제 #7
0
        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();
        }
예제 #8
0
 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;
     }
 }
예제 #9
0
        // 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();
        }
예제 #10
0
 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);
     }
 }
예제 #11
0
 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);
     }
 }
예제 #12
0
        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();
            }
        }
예제 #13
0
 public virtual void decide(Entity me, GameState environment, float timedelta, GameStateStack states)
 {
 }
예제 #14
0
 public virtual void decide(Entity me, GameState environment, float timedelta, GameStateStack states)
 {
 }
예제 #15
0
 public WinMenu(GameStateStack stack)
 {
     this.stack = stack;
 }
예제 #16
0
 public LoseMenu(GameStateStack stack)
 {
     this.stack = stack;
 }
예제 #17
0
        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;
            }
        }
예제 #18
0
 public WinMenu(GameStateStack stack)
 {
     this.stack = stack;
 }
예제 #19
0
 public MainMenu(GameStateStack gameStateStack) : base(gameStateStack)
 {
     // NOP
 }
예제 #20
0
 public void pauseDisconnect(GameStateStack states)
 {
     states.push(new PauseMenu(states, control));
 }
예제 #21
0
 public void pauseDisconnect(GameStateStack states)
 {
     states.push(new PauseMenu(states, control));
 }
예제 #22
0
 public LoseMenu(GameStateStack stack)
 {
     this.stack = stack;
 }