Beispiel #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Police"/> class.
 /// </summary>
 /// <param name="drawing">The drawing.</param>
 /// <param name="position">The position.</param>
 /// <param name="actualTile">The actual tile.</param>
 /// <param name="player">The player.</param>
 public Police(Texture2D drawing, Vector2 position, Tile actualTile, PlayableCharacter player)
     : base(drawing, position, actualTile)
 {
     this.drawing = drawing;
     this.position = position;
     this.actualTile = actualTile;
     this.state = new NormalState(this);
     this.player = player;
 }
Beispiel #2
0
 /// <summary>
 /// Checks if was taken.
 /// </summary>
 /// <param name="gru">The gru.</param>
 /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
 public bool CheckIfWasTaken(PlayableCharacter gru)
 {
     if (this.tile == gru.Destination && this.IsVisible)
     {
         visible = false;
         ScoreBoard.GetInstance().AddMoneyPoints();
         return true;
     }
     return false;
 }
Beispiel #3
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            gameState = GameState.menu;

            horizontalWall = Content.Load<Texture2D>(GameGraphics.HWALL);
            verticalWall = Content.Load<Texture2D>(GameGraphics.VWALL);
            textFont = Content.Load<SpriteFont>("Fonts/gamefont");

            // TODO: use this.Content to load your game content here
            Gru = new PlayableCharacter
                    (
                    Content.Load<Texture2D>(GameGraphics.GRU),
                    new Vector2(labyrinth.GetTile(START_X, START_Y).GetPosition().X, labyrinth.GetTile(START_X, START_Y).GetPosition().Y),
                    labyrinth.GetTile(START_X, START_Y)
                    );

            ship = new ExitShip(Content.Load<Texture2D>(GameGraphics.SHIP), labyrinth.GetRandomTile());

            policeList = new List<Police>();

            //L'entrée du téléporteur
            warpEntrance = Content.Load<Texture2D>(GameGraphics.WARP1);
            warpEntrancePos = new Vector2(labyrinth.GetTile(7, 4).GetPosition().X - Tile.TAILLE_LIGNE, labyrinth.GetTile(7, 4).GetPosition().Y + Tile.TAILLE_LIGNE);

            //Les sorties du téléporteur
            for (int i = 0; i < warpExit.Length; i++)
            {
                warpExit[i] = Content.Load<Texture2D>(GameGraphics.WARP2);
            }

            warpExitPos[0] = new Vector2(labyrinth.GetTile(0, 0).GetPosition().X, labyrinth.GetTile(0, 0).GetPosition().Y);
            warpExitPos[1] = new Vector2(labyrinth.GetTile(Labyrinth.WIDTH - 1, 0).GetPosition().X, labyrinth.GetTile(Labyrinth.WIDTH - 1, 0).GetPosition().Y);
            warpExitPos[2] = new Vector2(labyrinth.GetTile(0, Labyrinth.HEIGHT - 1).GetPosition().X, labyrinth.GetTile(0, Labyrinth.HEIGHT - 1).GetPosition().Y);
            warpExitPos[3] = new Vector2(labyrinth.GetTile(Labyrinth.WIDTH - 1, Labyrinth.HEIGHT - 1).GetPosition().X, labyrinth.GetTile(Labyrinth.WIDTH - 1, Labyrinth.HEIGHT - 1).GetPosition().Y);

            labyrinth.SpawnMoney(Content.Load<Texture2D>(GameGraphics.MONEY));

            currentPowerUp = CreateNewPowerUP();
            projectilesList = new List<Projectile>();

            gamepad = new Gamepad();
            gamepad.RegisterCommand(Buttons.DPadUp, new GruMoveUp(Gru));
            gamepad.RegisterCommand(Buttons.DPadDown, new GruMoveDown(Gru));
            gamepad.RegisterCommand(Buttons.DPadLeft, new GruMoveLeft(Gru));
            gamepad.RegisterCommand(Buttons.DPadRight, new GruMoveRight(Gru));
            gamepad.RegisterCommand(Buttons.LeftShoulder, new SpawnMinions(this));
            gamepad.RegisterCommand(Buttons.RightShoulder, new GruShoot(this));
            gamepad.RegisterCommand(Buttons.Back, new BackToMenu(this));
            gamepad.RegisterCommand(Buttons.Start, new PauseGame(this));
        }
Beispiel #4
0
        /// <summary>
        /// Creates the minions.
        /// </summary>
        public void CreateMinions()
        {
            if (minions.Count == 0)
            {
                Character minion = new ConfusedGhostMinion(Content.Load<Texture2D>(GameGraphics.MINION1), Gru.Position, Gru.actualTile, labyrinth);
                minions.Add(minion);
                minion = new ThiefMinion(Content.Load<Texture2D>(GameGraphics.MINION2), Gru.Position, Gru.actualTile, currentPowerUp.actualTile);
                minions.Add(minion);
                minion = new PlayableCharacter(Content.Load<Texture2D>(GameGraphics.MINION3), Gru.Position, Gru.actualTile);
                minions.Add(minion);

                gamepad.RegisterCommand(Buttons.Y, new MinionMoveUp(minion));
                gamepad.RegisterCommand(Buttons.A, new MinionMoveDown(minion));
                gamepad.RegisterCommand(Buttons.X, new MinionMoveLeft(minion));
                gamepad.RegisterCommand(Buttons.B, new MinionMoveRight(minion));
            }
        }
Beispiel #5
0
 public GruMoveLeft(PlayableCharacter gru)
 {
     this.gru = gru;
 }
Beispiel #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GruMoveDown"/> class.
 /// </summary>
 /// <param name="gru">The gru.</param>
 public GruMoveDown(PlayableCharacter gru)
 {
     this.gru = gru;
 }