private void StateActions(BindState state) { if (state == BindState.Pressed) { if (this.GameStateManager.IsActiveState <TitleScreen>()) { this.GameStateManager.PushState <HowToPlay>(false); } else if (this.GameStateManager.IsActiveState <PauseState>()) { this.GameStateManager.PopTo <TitleScreen>(false); } else if (this.GameStateManager.IsActiveState <LevelClearState>()) { this.GameStateManager.PopState(true); GetGameState <SceneManager>().RandomScene(false); } else if (this.GameStateManager.IsActiveState <HowToPlay>()) { //TODO: Load a scene somehow. Probably at random. this.GameStateManager.PushState <SceneManager>(false); var sceneManager = GetGameState <SceneManager>(); //sceneManager.ReloadScenes("", true); sceneManager.ResetScenes(); sceneManager.RandomScene(true); //sceneManager.ChangeScene("TestLevel", "", true); //TODO 2013/06/11: Fix reload timing so that player doesn't end up at the bottom } } }
private void ShootPlayer(BindState state) { if (state == BindState.Pressed) { PCC.Shoot("Sprites/Misc/arrow"); } }
private void TakeHealth(BindState state) { if (state == BindState.Pressed) { PCC.DecreaseHealth(); } }
private void GiveHealth(BindState state) { if (state == BindState.Pressed) { PCC.IncreaseHealth(); } }
private void CloseGame(BindState state) { if (state == BindState.Pressed) { this.Exit(); } }
private void ToggleViewEntities(BindState state) { if (state == BindState.Pressed) { Debugger.ToggleViewEntities(this.GetGameState <SceneManager>().ActiveScene); } }
/// <summary> /// Manually invokes this bind, raising the Pressed event and invoking the Action associated with it if Handled was false. /// </summary> internal void Invoke(BindState State) { this._State = State; var EventArgs = new BindPressEventArgs() { Action = this._Action, Handled = false, Player = InputManager.Player }; if (State == BindState.Pressed) { if (this.Pressed != null) { this.Pressed(this, EventArgs); } } else if (State == BindState.Released) { if (this.Released != null) { this.Released(this, EventArgs); } } if (!EventArgs.Handled) { this.Action(State); } }
private void ResetScene(BindState state) { if (state == BindState.Pressed) { ScrollerSerializer.ReloadEntities(); this.GetGameState <SceneManager>().ReloadScenes("", true); } }
private void ReloadPressed(BindState State) { if (State != BindState.Pressed) { return; } ReloadLevel(); }
public void Bind() { #if DEBUG BindState.Get().SetBoundFrameBuffer(DebugName); #endif GL.BindFramebuffer(FramebufferTarget.Framebuffer, frameBufferObject); bBind = true; }
private void ToggleGeometryPressed(BindState State) { if (State != BindState.Pressed) { return; } DisplayGeometry = !DisplayGeometry; }
private void TogglePerformancePressed(BindState State) { if (State != BindState.Pressed) { return; } DisplayPerformance = !DisplayPerformance; }
private void ToggleEntityPressed(BindState State) { if (State != BindState.Pressed) { return; } DisplayEntities = !DisplayEntities; }
private void ForceInvincibility(BindState state) { if (state == BindState.Pressed) { foreach (var player in this.Players) { player.Character.GetComponent <HealthComponent>().IsInvincible = !player.Character.GetComponent <HealthComponent>().IsInvincible; } } }
private void JumpPlayer(BindState state, bool allowMulti) { if (!_StateManager.IsActiveState <SceneManager>()) { return; } if (state == BindState.Pressed) { PCC.Jump(allowMulti); } }
private void JumpPressed(bool isMultijump, BindState State) { if (CorvusGame.Instance.StateManager.GetCurrentState() != CorvusGame.Instance.SceneManager) { return; } if (State == BindState.Pressed) { PlayerControlComponent.Jump(isMultijump); } }
private void MovePlayer(BindState state, Direction dir) { if (state == BindState.Pressed && _StateManager.IsActiveState <SceneManager>()) { PCC.BeginMove(dir); } else if (_StateManager.ContainsState <SceneManager>()) { PCC.StopMove(); } }
public void Unbind() { if (IsBind) { #if DEBUG BindState.Get().SetBoundFrameBuffer(""); #endif GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0); bBind = false; } }
private void OptionsSelect(BindState state) { if (CorvusGame.Instance.StateManager.GetCurrentState() != CorvusGame.Instance.OptionsState) { return; } if (state == BindState.Pressed) { CorvusGame.Instance.OptionsState.ControlManager.SelectControl(); } }
private void CrouchPlayer(BindState state) { if (state == BindState.Pressed && _StateManager.IsActiveState <SceneManager>()) { PCC.Crouch(); } else if (_StateManager.ContainsState <SceneManager>()) { PCC.StopMove(); } }
private void ClearCameraPressed(BindState State) { if (State != BindState.Pressed) { return; } if (!CurrentCamera.IsDisposed) { CurrentCamera.Dispose(); } Player.Character.Components.Add((CurrentCamera = new ChaseCameraComponent(Player.Camera))); }
private void Pause(BindState state) { if (state == BindState.Pressed) { if (_StateManager.IsActiveState <SceneManager>()) { _StateManager.PushState <PauseState>(true); } else if (_StateManager.IsActiveState <PauseState>()) { _StateManager.PopState(true); } } }
private void Attack(BindState State) { if (CorvusGame.Instance.StateManager.GetCurrentState() != CorvusGame.Instance.SceneManager) { return; } if (State == BindState.Pressed) { PlayerControlComponent.StartAttack(); } else if (State == BindState.Released) { PlayerControlComponent.EndAttack(); } }
public StateEitherImpl() { var bindEi = BindEither <err> .Instance; // To combine State and Either we need Traversable Either to State. var applSt = new ApplicativeState <st, Either <err> >(ap); var travEi = new TraversableEither <err, State <st> >(applSt); // If we have Monad and Traversable Either we can _bind_ (nest) Either inside State. var bindSt = new BindState <st, Either <err> >(bindEi, travEi); // Monad State with Either inside mo = new MonadState <st, Either <err> >(ap, bindSt); alt = new AltState <st, Either <err>, err>(ei, ap); th = new ThrowErrorState <st, Either <err>, err>(ei); trC = new TraversableCollection <State <st> >(applSt); }
private void Pause(BindState state) { if (CorvusGame.Instance.StateManager.GetCurrentState() == CorvusGame.Instance.MainMenuState || CorvusGame.Instance.StateManager.GetCurrentState() == CorvusGame.Instance.PausedState || CorvusGame.Instance.StateManager.GetCurrentState() == CorvusGame.Instance.OptionsState) { return; } if (state == BindState.Pressed) { CorvusGame.Instance.StateManager.PushState(CorvusGame.Instance.PausedState); } GamepadComponent.StopVibrations(); }
private void GameOver(BindState state, bool isContinue) { if (state == BindState.Pressed) { var isGameover = this.GameStateManager.IsActiveState <GameOverState>(); if (!isContinue && isGameover) { this.GameStateManager.PopTo <TitleScreen>(false); } else if (isGameover) { this.GameStateManager.OnMidTransition += StateManager_OnMidTransition; this.GameStateManager.PopState(false); } } }
protected void OnFoundParent() { if (IsVisible == false) { return; } if (Field == null || Field.BindedLine != this) { if (BindState != EBindState.Unbind) { Debug.Log(String.Format("{0} | state is not Unbind, is {1}", Text, BindState.ToString())); } // Fieldがまだ無い、またはヒープに返して他のLineに使われた Tree.Bind(this); foreach (Line child in this.GetAllChildren()) { child.OnFoundParent(); } } else if (Field.BindedLine == this && Field.gameObject.activeSelf == false) { if (BindState != EBindState.WeakBind) { Debug.Log(String.Format("{0} | state is not WeakBind, is {1}", Text, BindState.ToString())); } // ヒープに返したが、他のものには使われていなかった ReBind(); foreach (Line child in this.GetAllChildren()) { child.OnFoundParent(); } } else // Field != null && Field.BindedLine == this && && Field.gameObject.activeSelf { if (BindState != EBindState.Bind) { Debug.Log(String.Format("{0} | state is not Bind, is {1}", Text, BindState.ToString())); } // 適切なFieldをもう持っている if (Binding.transform.parent != Parent.Binding.transform) { Binding.transform.SetParent(Parent.Binding.transform, worldPositionStays: true); } AdjustLayout(); } }
private void ToggleMultiplayer(BindState state) { if (state == BindState.Pressed) { if (this.Players.Count() != 1) { this.RemovePlayer(this.Players.Where(p => p.Index == 2).Single()); } else { var player1 = this.Players.First(); var player2 = CreateNewPlayer(); player1.Character.Scene.AddEntity(player2.Character); player2.Character.Position = player1.Character.Position; } } }
private void BlockPressed(BindState State) { if (CorvusGame.Instance.StateManager.GetCurrentState() != CorvusGame.Instance.SceneManager) { return; } switch (State) { case BindState.Pressed: PlayerControlComponent.BeginBlock(); break; case BindState.Released: PlayerControlComponent.EndBlock(); break; } }
private void OptionsNavigation(bool isPrev, BindState state) { if (CorvusGame.Instance.StateManager.GetCurrentState() != CorvusGame.Instance.OptionsState) { return; } if (state == BindState.Pressed) { if (isPrev) { CorvusGame.Instance.OptionsState.ControlManager.PreviousControl(); } else { CorvusGame.Instance.OptionsState.ControlManager.NextControl(); } } }
private void TogglePerformancePressed(BindState State) { if(State != BindState.Pressed) return; DisplayPerformance = !DisplayPerformance; }
private void Attack(BindState State) { if (CorvusGame.Instance.StateManager.GetCurrentState() != CorvusGame.Instance.SceneManager) return; if (State == BindState.Pressed) PlayerControlComponent.StartAttack(); else if (State == BindState.Released) PlayerControlComponent.EndAttack(); }
private void BlockPressed(BindState State) { if (CorvusGame.Instance.StateManager.GetCurrentState() != CorvusGame.Instance.SceneManager) return; switch (State) { case BindState.Pressed: PlayerControlComponent.BeginBlock(); break; case BindState.Released: PlayerControlComponent.EndBlock(); break; } }
private void JumpPressed(bool isMultijump, BindState State) { if (CorvusGame.Instance.StateManager.GetCurrentState() != CorvusGame.Instance.SceneManager) return; if(State == BindState.Pressed) PlayerControlComponent.Jump(isMultijump); }
private void MovePressed(Direction Direction, BindState State) { if (CorvusGame.Instance.StateManager.GetCurrentState() != CorvusGame.Instance.SceneManager) return; switch(State) { case BindState.Pressed: PlayerControlComponent.BeginWalking(Direction); break; case BindState.Released: if (PlayerControlComponent.CurrentDirection == Direction) PlayerControlComponent.StopWalking(); break; } }
private void Pause(BindState state) { if (CorvusGame.Instance.StateManager.GetCurrentState() == CorvusGame.Instance.MainMenuState || CorvusGame.Instance.StateManager.GetCurrentState() == CorvusGame.Instance.PausedState || CorvusGame.Instance.StateManager.GetCurrentState() == CorvusGame.Instance.OptionsState) return; if (state == BindState.Pressed) CorvusGame.Instance.StateManager.PushState(CorvusGame.Instance.PausedState); GamepadComponent.StopVibrations(); }
private void PausedNavigation(bool isPrev, BindState state) { if (CorvusGame.Instance.StateManager.GetCurrentState() != CorvusGame.Instance.PausedState) return; if (state == BindState.Pressed) { if (isPrev) CorvusGame.Instance.PausedState.ControlManager.PreviousControl(); else CorvusGame.Instance.PausedState.ControlManager.NextControl(); } }
private void PausedSelect(BindState state) { if (CorvusGame.Instance.StateManager.GetCurrentState() != CorvusGame.Instance.PausedState) return; if (state == BindState.Pressed) CorvusGame.Instance.PausedState.ControlManager.SelectControl(); }
private void SwitchWeapon(bool isPrev, BindState state) { if (CorvusGame.Instance.StateManager.GetCurrentState() != CorvusGame.Instance.SceneManager) return; if (state == BindState.Pressed) { if (isPrev) PlayerControlComponent.SwitchWeapon(isPrev); else PlayerControlComponent.SwitchWeapon(isPrev); } }
/// <summary> /// Manually invokes this bind, raising the Pressed event and invoking the Action associated with it if Handled was false. /// </summary> internal void Invoke(BindState State) { this._State = State; var EventArgs = new BindPressEventArgs() { Action = this._Action, Handled = false, Player = InputManager.Player }; if(State == BindState.Pressed) { if(this.Pressed != null) this.Pressed(this, EventArgs); } else if(State == BindState.Released) { if(this.Released != null) this.Released(this, EventArgs); } if(!EventArgs.Handled) this.Action(State); }
private void ClearCameraPressed(BindState State) { if(State != BindState.Pressed) return; if(!CurrentCamera.IsDisposed) CurrentCamera.Dispose(); Player.Character.Components.Add((CurrentCamera = new ChaseCameraComponent(Player.Camera))); }
private void ReloadPressed(BindState State) { if(State != BindState.Pressed) return; ReloadLevel(); }
private void ToggleEntityPressed(BindState State) { if(State != BindState.Pressed) return; DisplayEntities = !DisplayEntities; }
private void ToggleGeometryPressed(BindState State) { if(State != BindState.Pressed) return; DisplayGeometry = !DisplayGeometry; }