public void OnNotify(Event ievent) { if (((KeyPressedEvent)ievent).key == Keys.key.Escape) { EventBroadcaster.GetBroadcaster().ChangeEvent(null, false); } }
public static StateManager GetStateManager() { if (_statemanager == null) { _statemanager = new StateManager(); EventBroadcaster.GetBroadcaster().RegisterListener(_statemanager); } return(_statemanager); }
public void OnNotify(Event ievent) { if ((ievent as KeyPressedEvent)?.key == Keys.key.Space) { EventBroadcaster.GetBroadcaster().ChangeEvent(new RunningState(), true); } else if ((ievent as KeyPressedEvent).key == Keys.key.Escape) { EventBroadcaster.GetBroadcaster().ChangeEvent(new EndState(), false); } }
public void OnNotify(Event ievent) { if (ievent is KeyPressedEvent) { if (((KeyPressedEvent)ievent).key == Keys.key.Escape) { EventBroadcaster.GetBroadcaster().ChangeEvent(null, false); } else { EventBroadcaster.GetBroadcaster().ChangeEvent(new PlayerOnStickState(), true); } } }
public void OnNotify(Event ievent) { if (ievent is KeyPressedEvent) { if (((KeyPressedEvent)ievent).key == Keys.key.Left || ((KeyPressedEvent)ievent).key == Keys.key.Right) { StickManager.GetStick().StickUpdate(((KeyPressedEvent)ievent).key); } else if (((KeyPressedEvent)ievent).key == Keys.key.Up) { EventBroadcaster.GetBroadcaster().ChangeEvent(new PlayerInAirState(), false); } else if (((KeyPressedEvent)ievent).key == Keys.key.Escape) { EventBroadcaster.GetBroadcaster().ChangeEvent(null, false); } } }
public void GetKey() { Event ievent; if (System.Windows.Input.Keyboard.IsKeyDown(System.Windows.Input.Key.Space)) { ievent = new KeyPressedEvent(Keys.key.Space); EventBroadcaster.GetBroadcaster().BroadcastEvent(ievent); } else if (System.Windows.Input.Keyboard.IsKeyDown(System.Windows.Input.Key.Escape)) { ievent = new KeyPressedEvent(Keys.key.Escape); EventBroadcaster.GetBroadcaster().BroadcastEvent(ievent); } else if (System.Windows.Input.Keyboard.IsKeyDown(System.Windows.Input.Key.Left)) { ievent = new KeyPressedEvent(Keys.key.Left); EventBroadcaster.GetBroadcaster().BroadcastEvent(ievent); } else if (System.Windows.Input.Keyboard.IsKeyDown(System.Windows.Input.Key.Right)) { ievent = new KeyPressedEvent(Keys.key.Right); EventBroadcaster.GetBroadcaster().BroadcastEvent(ievent); } else if (System.Windows.Input.Keyboard.IsKeyDown(System.Windows.Input.Key.Up)) { ievent = new KeyPressedEvent(Keys.key.Up); EventBroadcaster.GetBroadcaster().BroadcastEvent(ievent); } else if (System.Windows.Input.Keyboard.IsKeyDown(System.Windows.Input.Key.Escape)) { if (System.Windows.Input.Keyboard.IsKeyUp(System.Windows.Input.Key.Escape)) { ievent = new KeyReleasedEvent(Keys.key.Escape); EventBroadcaster.GetBroadcaster().BroadcastEvent(ievent); } } }
public void HandleCollision() { //int listNumber = 0, moodieNumber = 0, flag = 0; //for (listNumber = 0; listNumber < targets.MoodieList.Count; listNumber++) //{ // flag = 0; // for (moodieNumber = 0; moodieNumber < targets.MoodieList[listNumber].Count; moodieNumber++) // { // if (listNumber == targets.MoodieList.Count - 1 || listNumber != targets.MoodieList.Count - 1 && // targets.MoodieList[listNumber + 1][moodieNumber].getShowFlag() == false) // { // if (targets.MoodieList[listNumber][moodieNumber].GetYCoordinate() >= player.GetPlayerY() - 36 && // Enumerable.Range(player.GetPlayerX() - 50, player.GetPlayerX() + 50).Contains(targets.MoodieList[listNumber][moodieNumber].GetXCoordinate()) && // targets.MoodieList[listNumber][moodieNumber].getShowFlag() == true) // { // if (targets.MoodieList[listNumber][moodieNumber].GetType() == player.GetType()) // { // rowNumber = listNumber; // columnNumber = moodieNumber; // EventBroadcaster.GetBroadcaster().ChangeEvent(new PlayerCollideState(), false); // flag = 1; // break; // } // else // { // EventBroadcaster.GetBroadcaster().ChangeEvent(new PlayerOnStickState(), false); // } // } // } // } // if (flag == 1) // break; //} int listnumber = targets.MoodieList.Count - 1; while (listnumber >= 0) { int moodieNumber = player.GetPlayerX() / 50; if (targets.MoodieList[listnumber][moodieNumber].getShowFlag() == true && targets.MoodieList[listnumber][moodieNumber].GetType() == player.GetType()) { RowNumber = listnumber; ColumnNumber = moodieNumber; EventBroadcaster.GetBroadcaster().ChangeEvent(new PlayerCollideState(), false); break; } else if (targets.MoodieList[listnumber][moodieNumber].getShowFlag() == false) { listnumber--; } else if (targets.MoodieList[listnumber][moodieNumber].getShowFlag() == true && targets.MoodieList[listnumber][moodieNumber].GetType() != player.GetType()) { EventBroadcaster.GetBroadcaster().ChangeEvent(new PlayerOnStickState(), false); break; } } EventBroadcaster.GetBroadcaster().ChangeEvent(new PlayerOnStickState(), false); }
public void Update() { CollisionManager.GetCollisionManager().AddTargets(); EventBroadcaster.GetBroadcaster().ChangeEvent(new PlayerOnStickState(), false); }