Ejemplo n.º 1
0
 public Gamepad(PlayerCharacter Gru, DespicableGame game)
 {
     gamePadDown = new DownCommand(Gru);
     gamePadUp = new UpCommand(Gru);
     gamePadRight = new RightCommand(Gru);
     gamePadLeft = new LeftCommand(Gru);
     gamePadPowerup = new PowerupCommand(Gru);
     gamePadUnleashMinions = new UnleashMinionsCommand(Gru);
     gamePadExit = new ExitCommand(game);
     gamePadPause = new PauseCommand(game);
     inputMappings = new Dictionary<Buttons, ICommand>();
 }
Ejemplo n.º 2
0
        private GameManager()
        {
            labyrinth = new Labyrinth();
            policeHouseTiles = new List<Vector2>();

            policeHouseTiles.Add(new Vector2(6, 0));
            policeHouseTiles.Add(new Vector2(7, 0));
            policeHouseTiles.Add(new Vector2(0, 4));
            policeHouseTiles.Add(new Vector2(0, 5));
            policeHouseTiles.Add(new Vector2(6, 9));
            policeHouseTiles.Add(new Vector2(7, 9));
            policeHouseTiles.Add(new Vector2(13, 4));
            policeHouseTiles.Add(new Vector2(13, 5));

            countDowns = new List<Countdown>();
            newCountDowns = new List<Countdown>();

            characters = new List<Character>();
            charactersToDelete = new List<Character>();
            charactersToCreate = new List<Character>();
            countDownsToDelete = new List<Countdown>();

            Countdown firstTrapCountDown = new Countdown(0, 0, 30 - level, Subject.NotifyReason.SPAWN_NEW_TRAP);
            firstTrapCountDown.AddObserver(this);
            countDowns.Add(firstTrapCountDown);
            Countdown firstPowerupCountDown = new Countdown(0, 0, 25 - level, Subject.NotifyReason.SPAWN_NEW_POWERUP);
            firstPowerupCountDown.AddObserver(this);
            countDowns.Add(firstPowerupCountDown);

            collectibles = new List<Collectible>();
            collectiblesToDelete = new List<Collectible>();
            collectiblesToCreate = new List<Collectible>();

            level = 1;

            gru = (PlayerCharacter)CharacterFactory.CreateCharacter(CharacterFactory.CharacterType.GRU, new Vector2(labyrinth.GetTile(DEPART_X, DEPART_Y).GetPosition().X, labyrinth.GetTile(DEPART_X, DEPART_Y).GetPosition().Y), labyrinth.GetTile(DEPART_X, DEPART_Y));
            characters.Add(gru);
            gru.AddObserver(this);

            StartGame();

            shouldStartGame = false;

            //Teleporter entrance
            warpEntreePos = new Vector2(labyrinth.GetTile(7, 4).GetPosition().X - Tile.LIGN_SIZE, labyrinth.GetTile(7, 4).GetPosition().Y + Tile.LIGN_SIZE);

            //Teleporter exits
            warpExitsPos[0] = new Vector2(labyrinth.GetTile(0, 0).GetPosition().X, labyrinth.GetTile(0, 0).GetPosition().Y);
            warpExitsPos[1] = new Vector2(labyrinth.GetTile(Labyrinth.WIDTH - 1, 0).GetPosition().X, labyrinth.GetTile(Labyrinth.WIDTH - 1, 0).GetPosition().Y);
            warpExitsPos[2] = new Vector2(labyrinth.GetTile(0, Labyrinth.HEIGHT - 1).GetPosition().X, labyrinth.GetTile(0, Labyrinth.HEIGHT - 1).GetPosition().Y);
            warpExitsPos[3] = new Vector2(labyrinth.GetTile(Labyrinth.WIDTH - 1, Labyrinth.HEIGHT - 1).GetPosition().X, labyrinth.GetTile(Labyrinth.WIDTH - 1, Labyrinth.HEIGHT - 1).GetPosition().Y);
        }
Ejemplo n.º 3
0
 public LeftShoulderCommand(PlayerCharacter f)
 {
     player = f;
 }
Ejemplo n.º 4
0
 public YCommand(PlayerCharacter f)
 {
     player = f;
 }
Ejemplo n.º 5
0
 public LeftCommand(PlayerCharacter f)
 {
     player = f;
 }
Ejemplo n.º 6
0
 public UnleashMinionsCommand(PlayerCharacter f)
 {
     player = f;
 }
Ejemplo n.º 7
0
 public RightShoulderCommand(PlayerCharacter f)
 {
     player = f;
 }
Ejemplo n.º 8
0
 public RightCommand(PlayerCharacter f)
 {
     player = f;
 }
Ejemplo n.º 9
0
 public DownCommand(PlayerCharacter f)
 {
     player = f;
 }
Ejemplo n.º 10
0
 public PowerupCommand(PlayerCharacter f)
 {
     player = f;
 }