private static void CheckEnemyGateCollisions(Map map)
 {
     for (int enemyIndex = 0; enemyIndex < enemyRectangles.Count; enemyIndex++)
     {
         if(map.GetCastleGateCollision().Intersects(enemyRectangles[enemyIndex]))
         {
             StateManager.SetCurrentGameState(StateManager.GameState.Lose);
         }
     }
 }
        public static void CheckCollisions(Map map)
        {
            UpdateCollisionRectangles();
            CheckCharacterCollisions();
            CheckProjectileCollisions();
            CheckEnvironmentCollisions();
            CheckEnemyGateCollisions(map);
            CheckScreenCollisions();

            RemoveDeadCharacters();
            RemoveDeadProjectiles();
        }
        public static void Initialize(Map map)
        {
            playerRectangles = new List<Rectangle>();
            playerProjectiles = new List<Rectangle>();
            enemyRectangles = new List<Rectangle>();
            castleWalls = new List<Rectangle>();

            deadCharacters = new List<Character>();
            deadProjectiles = new List<Projectile>();

            castleWalls = map.GetCastleCollisionRectangles();

            for (int i = 0; i < CharacterManager.GetPlayers().Count; i++)
            {
                playerRectangles.Add(CharacterManager.GetPlayer(i).GetCollisionRectangle());
            }
        }
Example #4
0
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            mousePointer = AssetManager.GetTexture("Textures/swordPointer");
            mousePosition = new Vector2(Mouse.GetState().X, Mouse.GetState().Y);

            currState = Mouse.GetState();
            prevState = currState;

            CharacterManager.Initialize();
            ProjectileManager.Initialize();

            CharacterManager.AddPlayer(new Player(CharacterManager.GetCurrentID(),
                "Textures/tempChar",
                new Vector2(350, 100),
                Player.Class.Soldier,
                200));

            map = new Map();
            ui = new UserInterface();

            CollisionManager.Initialize(map);

            CharacterManager.AddEnemyWave();

            StateManager.SetCurrentGameState(StateManager.GameState.Intro);
        }