// Constructor
        public PatrolGuard(Texture2D textureImage, Vector2 position, Vector2 speed, Point spriteSize,
            Point sheetSize, Map gameMap, SpriteManager spriteManager , List<Vector2>PatrolOrder)
            : base(textureImage, position, speed, spriteSize, sheetSize, gameMap)
        {
            this.spriteManager = spriteManager;

            patrolReceive = PatrolOrder;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            spriteManager = new SpriteManager(this, myMap);
            Components.Add(spriteManager);

            base.Initialize();
        }
        // Constructor
        public GuardSprite(Texture2D textureImage, Vector2 position, Vector2 speed, Point spriteSize,
            Point sheetSize, Map gameMap, SpriteManager spriteManager, List<String> PatrolPathList, 
            bool initialStateIsPatrol)
            : base(textureImage, position, speed, spriteSize, sheetSize, gameMap)
        {
            this.spriteManager = spriteManager;
            this.PatrolPathList = PatrolPathList;
            this.initialStateIsPatrol = initialStateIsPatrol;
            this.startPosition = position;

            if (PatrolPathList.Count > 0)
            {
                CurrentPatrolDestinationPoint = ParsePatrolInstruction(PatrolPathList[CurrentPatrolPathListIndex++], false);
            }

            if (initialStateIsPatrol)
                CurrentState = GuardState.Patrol;
            else
                CurrentState = GuardState.Roam;

            RenewRoamDestination();
        }
Ejemplo n.º 4
0
 public GuardSprite(Texture2D textureImage, Vector2 position, Vector2 speed, Point spriteSize, 
     Point sheetSize, Map gameMap, SpriteManager spriteManager)
     : base(textureImage, position, speed, spriteSize, sheetSize, gameMap)
 {
     this.spriteManager = spriteManager;
 }
Ejemplo n.º 5
0
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            KeyboardState ks = Keyboard.GetState();
            if (ks.IsKeyDown(Keys.Escape))
                this.Exit();

            MouseState mouse = Mouse.GetState();

            if (PlayerSprite.Finished == 1) {
                CurrentGameState = GameState.GameOver;

            }

            if (changeState == true) {
                PlayerSprite.Finished = 0;
                changeState = false;
            }

            switch (CurrentGameState)
            {

                case GameState.MainMenu:
                    IsMouseVisible = true;
                    GameBegin = false;
                    Components.Remove(spriteManager);
                    if (GameBegin == false)
                    {
                        if (ButtnPlay.isClicked == true)
                        {

                            GameBegin = true;
                            CurrentGameState = GameState.Gameplay;
                        }

                        ButtnPlay.Update(mouse);
                    }
                    break;

                case GameState.Gameplay:

                    IsMouseVisible = false;
                    if (GameBegin == true)
                    {
                        spriteManager = new SpriteManager(this, myMap);
                        Components.Add(spriteManager);

                        GameBegin = false;

                    }
                    break;

                case GameState.GameOver:
                   IsMouseVisible = true;
                    GameBegin = false;
                    Components.Remove(spriteManager);
                    if (GameBegin == false)
                    {
                        if (ButtnPlay.isClicked == true)
                        {
                            changeState = true;
                            GameBegin = true;
                            CurrentGameState = GameState.Gameplay;
                        }

                        ButtnPlay.Update(mouse);
                    }
                    break;

            }

            // TODO: Add your update logic here

            base.Update(gameTime);
        }