public Overworld(Party playerParty, Area area)
        {
            if (playerParty == null)
                throw new Exception("Party playerParty cannot be null");

            PlayerParty = playerParty;
            Area = area;

            EnemyParties = new List<Party>();

            states = new Stack<OverworldState>();
            states.Push(new OverworldStates.Menu(this));
            stateChanged = true;

            Map = new Map(100, 100, 5, 5);

            PlayerParty.PrimaryPartyMember.StartOverworld(new Vector2(200.0f));
            addEntity(PlayerParty.PrimaryPartyMember.OverworldEntity);

            camera = new Camera(Game1.ScreenSize);
            camera.Target = playerParty.PrimaryPartyMember.OverworldEntity;

            //populateWithScenery();
            //populateWithEnemies();

            playerInvincibilityTimer = 0.0f;
        }
        public Battle(Party playerParty, Party enemyParty, Encounter overworldEncounter)
        {
            if (playerParty == null)
                throw new Exception("Party playerParty cannot be null");
            if (enemyParty == null)
                throw new Exception("Party enemyParty cannot be null");

            PlayerParty = playerParty.Tap(party => party.StartBattle(this));
            EnemyParty = enemyParty.Tap(party => party.StartBattle(this));

            states = new Stack<BattleState>();
            states.Push(new BattleStates.Intro(this));
            stateChanged = true;

            OverworldEncounter = overworldEncounter;

            Camera = new Camera(Game1.ScreenSize);
            Camera.Position = Camera.Size / 2.0f;
            cameraUpdateDelay = 0.0f;

            RepositionPartyMembers();
            updateCamera();
            Camera.Scale = Camera.TargetScale;
            updateCamera();
            Camera.Position = Camera.TargetPosition;

            generateBackground();
            generateBackgroundScenery();
            generateFloorScenery();

            whitePixelTextureData = ResourceManager.GetTextureData("white_pixel");
            arrowTextureData = ResourceManager.GetTextureData("arrow_down");
            CharacterClassHeadTextureData = new Dictionary<CharacterClass, TextureData> {
                { CharacterClass.Warrior, ResourceManager.GetTextureData("battle_ui/warrior_head") },
                { CharacterClass.Marksman, ResourceManager.GetTextureData("battle_ui/marksman_head") },
                { CharacterClass.Medic, ResourceManager.GetTextureData("battle_ui/medic_head") },
                { CharacterClass.Thief, ResourceManager.GetTextureData("battle_ui/thief_head") }
            };
            keyboardButtonTextureData = ResourceManager.GetTextureData("battle_ui/buttons/key");
            gamepadButtonTextureData = new Dictionary<InputButton, TextureData> {
                { InputButton.A, ResourceManager.GetTextureData("battle_ui/buttons/gamepad_a") },
                { InputButton.B, ResourceManager.GetTextureData("battle_ui/buttons/gamepad_b") },
                { InputButton.LeftTrigger, ResourceManager.GetTextureData("battle_ui/buttons/gamepad_lt") }
            };

            BorderTextureData = new TextureData[Directions.Length];
            for (int i = 0; i < Directions.Length; ++i)
                BorderTextureData[i] = ResourceManager.GetTextureData("battle_ui/borders/" + Directions[i]);

            PlayerPartyItemsUsed = 0;
            LastUsedThinkActionTypes = new ConditionalWeakTable<PartyMember, Wrapper<BattleStates.ThinkActionType>>();
        }