示例#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);
     }
 }
 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;
 }