public void GoToDestination(StateMainGame mg) { switch (Destination) { case "menu": { int nObjectManager = 4; GameObjectManager[] objectManagerArray = new GameObjectManager[nObjectManager]; objectManagerArray[0] = new ButtonManger(@"./Data/XML/buttonmanager.xml"); objectManagerArray[1] = new BackgroundManager(@"./Data/XML/menubg.xml"); objectManagerArray[2] = new MenuFrameManager(@"./Data/XML/menuframe.xml"); objectManagerArray[3] = new GameTitleManager(@"./Data/XML/gametitle.xml"); GlobalVariables.dX = 0; GlobalVariables.dY = 0; mg.Owner.GameState.ExitState(); mg.Owner.GameState = new StateLoading(); mg.Owner.GameState.InitState(null, mg.Owner); ((StateLoading)mg.Owner.GameState).GetDataLoading(mg.Owner.Content, @"./Data/XML/loadingtomenu.xml", objectManagerArray, typeof(StateMenu)); mg.Owner.GameState.EnterState(); mg.Owner.ResetElapsedTime(); } break; case "map01": { mg._map = (Map)mg._objectManagerArray[1].CreateObject(0); mg._map.Owner = mg; mg._char.SetMap(mg._map); mg._listMonsters = mg._map.InitMonsterList((MonsterManager)mg._objectManagerArray[2], @"Data\Map\map01\map01_monster.xml"); mg._frog.SetCharacter(mg._char); mg._listPortral = mg._map.InitPortralList((PortralManager)mg._objectManagerArray[4], @"Data\Map\map01\map01_portral.xml"); mg._char.X = DestX * GlobalVariables.MapCollisionDim; mg._char.Y = DestY * GlobalVariables.MapCollisionDim; GlobalVariables.dX = Math.Min(-mg._char.X + GlobalVariables.ScreenWidth / 2, 0); GlobalVariables.dY = Math.Min(-mg._char.Y + GlobalVariables.ScreenHeight / 2, 0); mg._char.DestPoint = new Point((int)mg._char.X, (int)mg._char.Y); } break; case "map02": { mg._map = (Map)mg._objectManagerArray[1].CreateObject(1); mg._map.Owner = mg; mg._char.SetMap(mg._map); mg._listMonsters = mg._map.InitMonsterList((MonsterManager)mg._objectManagerArray[2], @"Data\Map\map02\map02_monster.xml"); mg._frog.SetCharacter(mg._char); mg._listPortral = mg._map.InitPortralList((PortralManager)mg._objectManagerArray[4], @"Data\Map\map02\map02_portral.xml"); mg._char.X = DestX * GlobalVariables.MapCollisionDim; mg._char.Y = DestY * GlobalVariables.MapCollisionDim; GlobalVariables.dX = Math.Min(-mg._char.X + GlobalVariables.ScreenWidth / 2, 0); GlobalVariables.dY = Math.Min(-mg._char.Y + GlobalVariables.ScreenHeight / 2, 0); mg._char.DestPoint = new Point((int)mg._char.X, (int)mg._char.Y); } break; } }
public void GetStateOwner(StateMainGame _state) { _stateOwner = _state; }