/// <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); // TODO: use this.Content to load your game content here Shared.Stage = new Vector2(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight); // instantiate all scenes startScene = new StartScene(this, spriteBatch); this.Components.Add(startScene); actionScene = new ActionScene(this, spriteBatch); this.Components.Add(actionScene); helpScene = new HelpScene(this, spriteBatch); this.Components.Add(helpScene); highScoreScene = new HighScoreScene(this, spriteBatch); this.Components.Add(highScoreScene); aboutScene = new AboutScene(this, spriteBatch); this.Components.Add(aboutScene); gameOverScene = new GameOverScene(this, spriteBatch); this.Components.Add(gameOverScene); // show start scene startScene.Show(); }
public void finishGame(AbstractPlayer loser) { //Get the winner name string winner; if (loser == players[1]) { winner = players[2].ToString(); } else { winner = players[1].ToString(); } //Just enable the winning panel! ActionScene ags = (ActionScene)game.Services.GetService(typeof(ActionScene)); foreach (DrawableGameComponent gc in ags.SubComponents) { if (gc is PanelFinish) { ((PanelFinish)gc).setWinnerName(winner); gc.Enabled = true; gc.Visible = true; break; } } }
/// <summary> /// create a new action scene /// </summary> private void RebootActionScene() { this.Components.Remove(actionScene); actionScene = new ActionScene(this, spriteBatch); this.Components.Add(actionScene); this.Components.Remove(gameOverScene); this.Components.Add(gameOverScene); }
public override void Update(GameTime gameTime) { #region Player Collisions if (!isPickedUp) { foreach (var comp in Game.Components) { if (comp is ActionScene) { ActionScene actionScene = comp as ActionScene; foreach (object obj in actionScene.Components) { if (obj is Player) { Player player = obj as Player; Sides playerCollisions = treasure.CheckCollisions(player.player); // player.player is the player rectangle if (playerCollisions != Sides.None) { player.Score += 1500; isPickedUp = true; soundEffect.Play(); HighScoreScene.GameFinished(player.Score + player.health); foreach (object obj2 in actionScene.Components) { if (obj2 is HUD)// { if (obj2 is HUD) { HUD hud = obj2 as HUD; hud.showLevelComplete = true; } } } } } } } } } #endregion #region Animation currentFrameDelayCount++; if (currentFrameDelayCount > FRAMEDELAYMAXCOUNT) { currentFrameDelayCount = 0; currentFrame++; } #endregion base.Update(gameTime); }
public static void TopicDicSetHook(ActionScene __instance) { foreach (var customTopic in _customTopics) { var no = customTopic.Key; if (__instance._topicDic.ContainsKey(no)) { KoikatuAPI.Logger.LogWarning($"Overwriting existing topic No={no} Name={__instance._topicDic[no].Name} with Name={customTopic.Value.Param.Name}"); } __instance._topicDic[no] = customTopic.Value.Param; } }
private void CustomLoad() { dataLoader = new DataLoader(); Global.dataLoader = dataLoader; dataLoader.LoadAllContent(contentManager); intro = new IntroScene(this); action = new ActionScene(this); editor = new EditorScene(this); input = new InputManager(scene); Global.Running = true; Global.p = contentManager.Load <Texture2D>("Images/UI/white"); //MediaPlayer.Play(Content.Load<Song>("Audio/Music/KnuxTheme")); }
public void crearJuego(int width, int height) { size = new Vector2(width, height); this.pictureBox.Width = (int)size.X; this.pictureBox.Height = (int)size.Y; // test graphics.PreferredBackBufferWidth = pictureBox.Width; graphics.PreferredBackBufferHeight = pictureBox.Height; graphics.ApplyChanges(); escenaAccion = new ActionScene(this, fondo, size); escenaAccion.modoFramework = true; Components.Add(escenaAccion); escenaAccion.Show(); //escenaInicio.Show(); //escenaAyuda.Hide(); //escenaActiva = escenaInicio; escenaActiva = escenaAccion; }
// This adds the action scene to the pool of action scenes running in the update loop public void StartActionScene(ActionScene actScene) { //// Reset all actions in scene to active = false, finished = false; //foreach (ParallelActions parActs in actScene.parallelActs) { // foreach(Action act in parActs.actions) { // act.Active = false; // act.Finished = false; // } //} //// Set first set of parallel actions in scene to active/current and run it //actScene.activeParallelActs = actScene.parallelActs[0]; //RunAllParallelActions(actScene.activeParallelActs); // Initialize the scene // Make it active, set the first set of ParallelActions as active, set the ParallelActions index to 0, initialize all actions contained within actScene.InitializeScene(); scenes.Add(actScene); }
private void SetScene(GameScene scene) { this.scene = scene; if (scene.kind == Scene.LOAD) { load = (LoadScene)scene; } else if (scene.kind == Scene.INTRO) { intro = (IntroScene)scene; } else if (scene.kind == Scene.ACTION) { action = (ActionScene)scene; } else if (scene.kind == Scene.EDITOR) { editor = (EditorScene)scene; } }
/// <summary> /// Loads all of the content to play the game, loads all the scenes and the music for the scenes /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // Adding our scenes to our components aswell as to the services // to be able to directly access the components list from other classes menuScene = new MenuScene(this, spriteBatch); this.Components.Add(menuScene); this.Services.AddService <MenuScene>(menuScene); menuScene.Show(); actionScene = new ActionScene(this, spriteBatch); this.Components.Add(actionScene); this.Services.AddService <ActionScene>(actionScene); actionScene.Hide(); helpScene = new HelpScene(this, spriteBatch); this.Components.Add(helpScene); this.Services.AddService <HelpScene>(helpScene); helpScene.Hide(); creditScene = new CreditScene(this, spriteBatch); this.Components.Add(creditScene); this.Services.AddService <CreditScene>(creditScene); creditScene.Hide(); gameOverScene = new GameOverScene(this, spriteBatch); this.Components.Add(gameOverScene); this.Services.AddService <GameOverScene>(gameOverScene); gameOverScene.Hide(); // Getting the music for the scenes menuSong = this.Content.Load <Song>("Music/Menu"); actionSong = this.Content.Load <Song>("Music/Action"); MediaPlayer.Play(menuSong); MediaPlayer.IsRepeating = true; MediaPlayer.Volume = 0.1f; }
// Update is called once per frame void Update() { // This manages individual actions if (singleActs.Count > 0) { for (int i = 0; i < singleActs.Count; i++) { if (Time.time - singleActs[i].StartTime > singleActs[i].Duration) { //singleActs[i].act.FinalizeAction(); singleActs[i].Active = false; GameObject.Find(singleActs[i].ActorName).transform.Find("ID").GetComponent <ID>().preventActionTrigger = false; singleActs.Remove(singleActs[i]); } } } // This manages the action scenes -- the scene is added to scenes, the first parallel action set in the scene is run in StartActionScene(), and this loop continues it if (scenes.Count > 0) { for (int i = 0; i < scenes.Count; i++) { ActionScene scene = scenes[i]; if (scene.parallelActs.Count > 0 && scene.active) { //ParallelActions currentParallelActions = scene.activeParallelActs; //for (int j = 0; j < currentParallelActions.actions.Count; j++) { // Action act = currentParallelActions.actions[j]; // if (Time.time - act.StartTime > act.Duration) { // act.Active = false; // act.Finished = true; // } //} //if (AreParallelActionsAllDone(currentParallelActions)) { // int index = scene.parallelActs.IndexOf(currentParallelActions); // if (index < scene.parallelActs.Count - 1) { // currentParallelActions = scene.parallelActs[index + 1]; // RunAllParallelActions(currentParallelActions); // } // else { // scene.active = false; // scenes.Remove(scene); // } //} scene.CueNextParallelActions(); } } } if (contingentActions.Count > 0) { foreach (Action act in contingentActions) { if (RequiredItemsCheckForSingleAction(act)) { TriggerAction(act); contingentActions.Remove(act); } } } }
public ThrowGrenadeState(ActionScene Scene, Vector3 SourcePosition) : base(Scene) { ThrowSourcePosition = SourcePosition; }
public static void ActionScene_NPCLoadAllPreHook(ActionScene __instance) { __instance.StartCoroutine(DelayedReloadChara(null)); }
public BaseActionSceneState(ActionScene SceneForState) { Scene = SceneForState; }
/// <summary> /// Set the value of isCursorLock (setter is private by default). /// Used to regain mouse cursor during roaming mode. /// Best used together with setting <see cref="Time.timeScale"/> to 0 to pause the game. /// </summary> public static void SetIsCursorLock(this ActionScene actScene, bool value) { var lockField = Traverse.Create(actScene).Field <bool>("_isCursorLock"); lockField.Value = value; }
/// <summary> /// Start a new "light" ADV scene that only pauses player input and shows a dialog box. Can be used in roaming mode and some other cases. /// Best to use this for events where player thinks or talks to himself with no other characters participating, for example after picking up an item on the map. /// Do not use in TalkScenes, use <see cref="StartTextSceneEvent"/> instead. /// You can get variables set in the commands through actScene.AdvScene.Scenario.Vars /// You need to use Program.SetParam if you want to add parameters related to a heroine. Alternatively use the CharaChange command with the global heroine syntax. /// Warning: You have to have a Close command or the scene will softlock after reaching the end! /// </summary> /// <param name="commands">List of commands for the event</param> public static IEnumerator StartMonologueEvent(IEnumerable <Program.Transfer> commands) { if (commands == null) { throw new ArgumentNullException(nameof(commands)); } var list = commands.ToList(); if (list.All(x => x.param.Command != Command.Close)) { list.Add(Program.Transfer.Close()); UnityEngine.Debug.LogWarning("No Close command in the transfer list! Adding close at end to prevent lockup. Add Program.Transfer.Close() at the end of list to fix this."); } // todo handle this properly? Used when going back to title screen from F1 menu and possibly other places. Possibly not a problem since we run as a coroutine? var token = CancellationToken.None; var actScene = ActionScene.instance; // Stop player input and some game functions actScene.Player.isActionNow = true; var prevBGM = string.Empty; var prevVolume = 1f; yield return(TuplelessGetBgmAndVolume((x, y) => { prevBGM = x; prevVolume = y; })); ActionScene instance = SingletonInitializer <ActionScene> .instance; Transform transform = Camera.main.transform; bool isOpenADV = false; // Run the actual scene yield return(Program.Open(new Data { position = instance.Player.position, rotation = instance.Player.rotation, scene = instance, camera = new OpenData.CameraData { position = transform.position, rotation = transform.rotation }, transferList = list }, token, new Program.OpenDataProc { onLoad = delegate { isOpenADV = true; } }).ToCoroutine(UnityEngine.Debug.LogException)); // Wait until the scene is done yield return(UniTask.WaitUntil(() => isOpenADV, PlayerLoopTiming.Update, token).ToCoroutine(UnityEngine.Debug.LogException)); yield return(Program.ADVProcessingCheck(token).ToCoroutine(UnityEngine.Debug.LogException)); // Fade back to gameplay, assuming the script faded to loading screen, does nothing otherwise yield return(Illusion.Game.Utils.Sound.GetFadePlayerWhileNull(prevBGM, prevVolume).ToCoroutine(UnityEngine.Debug.LogException)); Scene.sceneFadeCanvas.DefaultColor(); // Reenable player controls actScene.Player.isActionNow = false; }
public FireTeamTurnState(ActionScene SceneForScene) : base(SceneForScene) { CameraDirector = Scene.GetComponent<CameraManager>(); }
ActionScene SetUpActionScene2(IController controllerOne, IController controllerTwo) { Components.OfType<ActionScene>().ToList().ForEach(a => { Components.Remove(a); a.Dispose(); }); _actionScene = new ActionScene(controllerOne, controllerTwo,this, actionElementsTexture, actionBackgroundTexture, this.GetScreenBounds(),scoreFont); Components.Add(_actionScene); return _actionScene; }
/// <summary> /// Set the value of isCursorLock (setter is private by default). /// Used to regain mouse cursor during roaming mode. /// Best used together with setting <see cref="Time.timeScale"/> to 0 to pause the game. /// </summary> public static void SetIsCursorLock(this ActionScene actScene, bool value) { actScene._isCursorLock = value; }
void HandleStartSceneInput() { if (this._menuControllers.Any(m => m.IsEnter)) { _audio.MenuSelect.Play(); switch ((StartScene.MenuItems)_startScene.SelectedMenuIndex) { case StartScene.MenuItems.OnePlayer: _actionScene = SetupActionScene1(this._menuControllers.ToArray()); this.Components.Add(_actionScene); ShowScene(_actionScene); // skip join, use all controllers break; case StartScene.MenuItems.TwoPlayers: ShowScene(_joinScene); break; case StartScene.MenuItems.Help: ShowScene(_helpScene); break; case StartScene.MenuItems.Scores: // scores this.ShowScene(_scoreScene); break; case StartScene.MenuItems.Quit: Exit(); break; } } }
public override void Update(GameTime gameTime) { if (health <= 0) // Player died { if (isAlive) { // Player has now JUST died. foreach (var comp in Game.Components) { if (comp is ActionScene) { ActionScene actionScene = comp as ActionScene; foreach (object obj in actionScene.Components) { if (obj is Player) { Player player = obj as Player; player.Score += 500; } } } } if (type == EnemyType.WALKER) { Treasure treasure = new Treasure(Game, spriteBatch, enemy); Game.Components.Add(treasure); } isAlive = false; } } if (isAlive && gameTime.TotalGameTime.TotalMilliseconds - lastShot > SHOOTDELAYMS) { lastShot = (float)gameTime.TotalGameTime.TotalMilliseconds; Bullet bullet = new Bullet(Game, spriteBatch, enemy.X + 30, enemy.Y + 20, shotDirection, BulletType.ENEMY); Game.Components.Add(bullet); } if (type == EnemyType.WALKER) { shotDirection = (float)Math.PI; if (enemy.X == MINX) { increasing = true; } else if (enemy.X == MAXX) { increasing = false; } if (increasing) { enemy.X++; } else { enemy.X--; } #region Moving if (increasing) { spriteDirection = (float)Math.PI / 2f; } else { spriteDirection = 3f * (float)Math.PI / 2f; } currentFrameDelayCount++; if (currentFrameDelayCount > FRAMEDELAYMAXCOUNT) { currentFrameDelayCount = 0; currentFrame++; } if (currentFrame > WALKFRAMES) { currentFrame = FIRSTWALKFRAME; } #endregion } else if (type == EnemyType.STILL) { shotDirection = (float)Math.PI / 2f; } base.Update(gameTime); }
public void BeginActingRoutine(ActionScene routine) { }
private void HandleStartSceneInput() { if (menuControllers.Any(m => m.IsEnter)) { _audio.MenuSelect.Play(); switch (_startScene.SelectedMenuIndex) { case 0: _actionScene = SetupActionScene1(menuControllers.ToArray()); Components.Add(_actionScene); ShowScene(_actionScene); break; case 1: ShowScene(_joinScene); break; case 2: ShowScene(_helpScene); break; case 3: ShowScene(_creditScene); break; case 4: Exit(); break; } } }
private void HandleScenesInput() { if (_activeScene == _startScene) { HandleStartSceneInput(); } else if (_activeScene == _helpScene) { HandleHelpSceneInput(); } else if (_activeScene == _actionScene) { HandleActionInput(); } else if (_activeScene == _joinScene) { if (_joinScene.BothConfirmed) { _actionScene = SetUpActionScene2(_joinScene.PlayerOne, _joinScene.PlayerTwo); ShowScene(_actionScene); } } else if (_activeScene == _creditScene) { HandleCreditsInput(); } }
public override void Update(GameTime gameTime) { if (isAlive) { #region Wall Collisions foreach (var comp in Game.Components) { if (comp is ActionScene) { ActionScene actionScene = comp as ActionScene; foreach (object obj in actionScene.Components) { if (obj is Background) { Background background = obj as Background; Sides backgroundCollisions = bullet.CheckCollisions(background.rigidBodies); if (backgroundCollisions != Sides.None) { isAlive = false; // Bullet death } } } } } #endregion #region Door Collisions foreach (var comp in Game.Components) { if (comp is ActionScene) { ActionScene actionScene = comp as ActionScene; foreach (object obj in actionScene.Components) { if (obj is Door) { Door door = obj as Door; Sides doorCollisions = bullet.CheckCollisions(door.door); // door.door is the enemy rectangle if (doorCollisions != Sides.None && door.isLocked) { isAlive = false; // Bullet death } } } } } #endregion #region Enemy Collisions if (type == BulletType.PLAYER) // Player shot this bullet { foreach (var comp in Game.Components) { if (comp is ActionScene) { ActionScene actionScene = comp as ActionScene; foreach (object obj in actionScene.Components) { if (obj is Enemy)// Player shot this bullet { Enemy enemy = obj as Enemy; Sides enemyCollisions = bullet.CheckCollisions(enemy.enemy); // enemy.enemy is the enemy rectangle if (enemyCollisions != Sides.None && enemy.health > 0) { enemy.health -= 26; isAlive = false; // Bullet death } } } } } } #endregion #region Player Collisions if (type == BulletType.ENEMY) // Enemy shot this bullet { foreach (var comp in Game.Components) { if (comp is ActionScene) { ActionScene actionScene = comp as ActionScene; foreach (object obj in actionScene.Components) { if (obj is Player)// Player shot this bullet { Player player = obj as Player; Sides playerCollisions = bullet.CheckCollisions(player.player); // enemy.enemy is the enemy rectangle if (playerCollisions != Sides.None) { player.health -= 10; isAlive = false; // Bullet death } } } } } } #endregion bullet.X += (int)velocity.X; bullet.Y += (int)velocity.Y; #region Animation currentFrameDelayCount++; if (currentFrameDelayCount > FRAMEDELAYMAXCOUNT) { currentFrameDelayCount = 0; currentFrame++; } #endregion } else { this.Dispose(); } base.Update(gameTime); }
ActionScene SetupActionScene1(params IController[] controllers) { Components.OfType<ActionScene>().ToList().ForEach(a => { Components.Remove(a); a.Dispose(); }); _actionScene = new ActionScene(this, actionElementsTexture, actionBackgroundTexture, scoreFont, this.GetScreenBounds(), controllers); return _actionScene; }
public override void Update(GameTime gameTime) { float deltaTime = (float)gameTime.ElapsedGameTime.TotalMilliseconds; velocity.X = 0; velocity.Y += GRAVITY * deltaTime; //get input KeyboardState keyState = Keyboard.GetState(); //add SPEED to velocity (as required) if (keyState.IsKeyDown(Keys.D)) { velocity.X = SPEED; isPlayerFacingRight = true; } if (keyState.IsKeyDown(Keys.A)) { velocity.X = -SPEED; isPlayerFacingRight = false; } if (keyState.IsKeyDown(Keys.W)) { if (!isJumping && isGrounded) // ready to jump { jumpSound.Play(); isJumping = true; isGrounded = false; currentJumpPower = JUMPPOWER; // this is maximum "thrust" at the very beginning of jump } } if (bulletDelay <= bulletDelayTime) { bulletDelay += gameTime.ElapsedGameTime.Milliseconds; } if (keyState.IsKeyDown(Keys.Space)) //for shooting for pink player { if (bulletDelay >= bulletDelayTime) { gunSound.Play(); bulletList.Add(new Bullet(new Vector2(_rectangle.X + 20, _rectangle.Y + 20), isPlayerFacingRight)); bulletDelay = 0; //resetting time since last bullet fired to 0 } } if (isJumping) { if (currentJumpPower < 0) // we still have upward thrust { velocity.Y -= JUMPSTEP; currentJumpPower++; } else { isJumping = false; //now we are falling } } // our new location becomes the "proposed" location Rectangle proposedLocation = new Rectangle(_rectangle.X + (int)velocity.X, _rectangle.Y + (int)velocity.Y, _rectangle.Width, _rectangle.Height); // check if move is ok Sides collisionSides = proposedLocation.CheckCollisions(background.RigidBodyList); if ((collisionSides & Sides.RIGHT) == Sides.RIGHT) { if (velocity.X > 0) { velocity.X = 0; } } if ((collisionSides & Sides.LEFT) == Sides.LEFT) { if (velocity.X < 0) { velocity.X = 0; } } if ((collisionSides & Sides.TOP) == Sides.TOP) { isJumping = false; velocity.Y = SPEED; } foreach (Bullet bullet in bulletList) { Enemy enemy = Game.Components.OfType <Enemy>().First(); if (enemy != null && bullet.Bounds.Intersects(enemy.Rectangle)) { health--; if (health <= 0) { enemy.Enabled = false; enemy.Visible = false; ActionScene scene = Game.Components.OfType <ActionScene>().First(); scene.Restart(); } bulletList.Remove(bullet); break; } } if ((collisionSides & Sides.BOTTOM) == Sides.BOTTOM && (currentJumpPower != JUMPPOWER)) { velocity.Y = 0; isGrounded = true; } //absolutely ok, update location to "proposed" //anim if (velocity.X < 0) { spriteDirection = SpriteEffects.FlipHorizontally; } else if (velocity.X > 0) { spriteDirection = SpriteEffects.None; } // when jumping if (isJumping) { currentFrame = JUMPFRAME; //player.Width = JUMPFRAMEWIDTH, JUMPFRAMEHEIGHT) } else { //STANDFRAMEWIDTH, STANDFRAMEHEIGHT } //when standing // equivalent to if(isGrounded == TRUE) if (isGrounded) { //and standing if (nearlyZero(velocity.X)) { //STANDFRAMEWIDTH, STANDFRAMEHEIGHT currentFrame = STANDFRAME; } // or walking else { //WALKFRAMEWIDTH, WALKFRAMEHEIGHT currentFrameDelayCount++; if (currentFrameDelayCount > FRAMEDELAYMAXCOUNT) { currentFrameDelayCount = 0; currentFrame++; //advance to the next frame } if (currentFrame > WALKFRAMES) { currentFrame = FIRSTWALKFRAME; } } } _rectangle.X = _rectangle.X + (int)velocity.X; _rectangle.Y = _rectangle.Y + (int)velocity.Y; base.Update(gameTime); }
private static void CreateButtons(ChaStatusScene __instance, ChaStatusComponent ___cmpMale) { try { if (_actionScene == null) { _actionScene = FindObjectOfType <ActionScene>(); } if (_template == null) { var go = new GameObject(ButtonName + "_template"); go.transform.SetParent(_actionScene.transform, false); var image = go.AddComponent <Image>(); var texture2D = ResourceUtils.GetEmbeddedResource("button.png").LoadTexture(TextureFormat.DXT5); var spriteMoveIcon = Sprite.Create(texture2D, new Rect(0f, 0f, texture2D.width, texture2D.height), new Vector2(0.5f, 0.5f), 100f, 0U, SpriteMeshType.FullRect); image.sprite = spriteMoveIcon; var button = go.AddComponent <Button>(); button.targetGraphic = image; var rt = go.GetComponent <RectTransform>(); rt.anchorMin = rt.anchorMax = new Vector2(0.97f, 0.73f); rt.offsetMin = new Vector2(-40, -40); rt.offsetMax = Vector2.zero; go.SetActive(false); _template = go; DontDestroyOnLoad(go); } foreach (var chaStatusComponent in __instance.gameObject.GetComponentsInChildren <ChaStatusComponent>()) { if (chaStatusComponent == ___cmpMale) { continue; } // Do not show the button if character is on the same map as player var npc = GetCharaNpc(chaStatusComponent); if (npc == null || npc.mapNo == _actionScene.Player.mapNo) { continue; } var cardTr = chaStatusComponent.cmpStudentCard.transform; var go = GameObject.Instantiate(_template, cardTr, false); go.name = ButtonName; var button = go.GetComponent <Button>(); if (button != null) { button.onClick.AddListener(() => WarpToNpc(npc)); } go.SetActive(true); } } catch (Exception e) { UnityEngine.Debug.LogException(e); } }
public void Query(GameScene scene) { //Gets Input if (TouchPanel.GetCapabilities().IsConnected) { TouchCollection coll = TouchPanel.GetState(); oldState = currentState; bool[] tempState = new bool[9]; foreach (TouchLocation loc in coll) { bool touchDPad = (Global.Distance(DPadCenter, loc.Position) <= DPadRect.Width / 2f); if (touchDPad && (loc.Position.Y < -Math.Abs(loc.Position.X - DPadCenter.X) + DPadCenter.Y)) { tempState[0] = true; } if (touchDPad && (loc.Position.Y > Math.Abs(loc.Position.X - DPadCenter.X) + DPadCenter.Y)) { tempState[1] = true; } if (touchDPad && (loc.Position.X < -Math.Abs(loc.Position.Y - DPadCenter.Y) + DPadCenter.X)) { tempState[2] = true; } if (touchDPad && (loc.Position.X > Math.Abs(loc.Position.Y - DPadCenter.Y) + DPadCenter.X)) { tempState[3] = true; } if (Global.Distance(ACenter, loc.Position) <= ARect.Width / 2f) { tempState[4] = true; } if (Global.Distance(BCenter, loc.Position) <= BRect.Width / 2f) { tempState[5] = true; } if (loc.Position.X >= EnterRect.X && loc.Position.X < EnterRect.X + EnterRect.Width && loc.Position.Y >= EnterRect.Y && loc.Position.Y < EnterRect.Y + EnterRect.Height) { tempState[6] = true; } if (loc.Position.X >= AltRect.X && loc.Position.X < AltRect.X + AltRect.Width && loc.Position.Y >= AltRect.Y && loc.Position.Y < AltRect.Y + AltRect.Height) { tempState[7] = true; } if (loc.Position.X >= HomeRect.X && loc.Position.X < HomeRect.X + EnterRect.Width && loc.Position.Y >= HomeRect.Y && loc.Position.Y < HomeRect.Y + HomeRect.Height) { tempState[8] = true; } } currentState = tempState; } //Query for it here... if (scene.kind == Scene.INTRO) { } else if (scene.kind == Scene.ACTION) { ActionScene action = (ActionScene)scene; if (currentState[(int)Buttons.Up]) { if (action.mode == ActionScene.Mode.OVERWORLD) { action.tileMap.player.Move(Model.Entities.Terrain.Tile.Direction.NORTH); } else if (action.mode == ActionScene.Mode.BATTLE) { action.battleMap.GetPlayer().Move(Model.Entities.Terrain.Tile.Direction.NORTH); } } else if (currentState[(int)Buttons.Down]) { if (action.mode == ActionScene.Mode.OVERWORLD) { action.tileMap.player.Move(Model.Entities.Terrain.Tile.Direction.SOUTH); } else if (action.mode == ActionScene.Mode.BATTLE) { action.battleMap.GetPlayer().Move(Model.Entities.Terrain.Tile.Direction.SOUTH); } } else if (currentState[(int)Buttons.Left]) { if (action.mode == ActionScene.Mode.OVERWORLD) { action.tileMap.player.Move(Model.Entities.Terrain.Tile.Direction.WEST); } else if (action.mode == ActionScene.Mode.BATTLE) { action.battleMap.GetPlayer().Move(Model.Entities.Terrain.Tile.Direction.WEST); } } else if (currentState[(int)Buttons.Right]) { if (action.mode == ActionScene.Mode.OVERWORLD) { action.tileMap.player.Move(Model.Entities.Terrain.Tile.Direction.EAST); } else if (action.mode == ActionScene.Mode.BATTLE) { action.battleMap.GetPlayer().Move(Model.Entities.Terrain.Tile.Direction.EAST); } } else { if (action.mode == ActionScene.Mode.BATTLE) { action.battleMap.GetPlayer().MoveReleased(); } } if (!oldState[(int)Buttons.Down] && currentState[(int)Buttons.Down]) { if (action.dialog.visible) { if (action.dialog.options != null) { if (action.dialog.optionCursor >= action.dialog.options.Length - 1) { action.dialog.optionCursor = 0; } else { action.dialog.optionCursor++; } } } } if (!oldState[(int)Buttons.Up] && currentState[(int)Buttons.Up]) { if (action.dialog.visible) { if (action.dialog.options != null) { if (action.dialog.optionCursor <= 0) { action.dialog.optionCursor = action.dialog.options.Length - 1; } else { action.dialog.optionCursor--; } } } } if (!oldState[(int)Buttons.A] && currentState[(int)Buttons.A]) { if (action.mode == ActionScene.Mode.OVERWORLD) { action.tileMap.player.AButton(); } } if (currentState[(int)Buttons.B]) { } if (currentState[(int)Buttons.Enter]) { if (action.mode == ActionScene.Mode.OVERWORLD) { action.tileMap.SetLighting(true); } else if (action.mode == ActionScene.Mode.BATTLE) { action.battleMap.SetNightTime(true); } } if (currentState[(int)Buttons.Alt]) { if (action.mode == ActionScene.Mode.OVERWORLD) { action.tileMap.SetLighting(false); } else if (action.mode == ActionScene.Mode.BATTLE) { action.battleMap.SetNightTime(false); } } if (currentState[(int)Buttons.Home]) { } } else if (scene.kind == Scene.LOAD) { } else if (scene.kind == Scene.EDITOR) { } }