Exemple #1
0
        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();
     }
 }
Exemple #5
0
 private void CloseGame(BindState state)
 {
     if (state == BindState.Pressed)
     {
         this.Exit();
     }
 }
Exemple #6
0
 private void ToggleViewEntities(BindState state)
 {
     if (state == BindState.Pressed)
     {
         Debugger.ToggleViewEntities(this.GetGameState <SceneManager>().ActiveScene);
     }
 }
Exemple #7
0
        /// <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);
            }
        }
Exemple #8
0
 private void ResetScene(BindState state)
 {
     if (state == BindState.Pressed)
     {
         ScrollerSerializer.ReloadEntities();
         this.GetGameState <SceneManager>().ReloadScenes("", true);
     }
 }
Exemple #9
0
 private void ReloadPressed(BindState State)
 {
     if (State != BindState.Pressed)
     {
         return;
     }
     ReloadLevel();
 }
Exemple #10
0
        public void Bind()
        {
#if DEBUG
            BindState.Get().SetBoundFrameBuffer(DebugName);
#endif
            GL.BindFramebuffer(FramebufferTarget.Framebuffer, frameBufferObject);
            bBind = true;
        }
Exemple #11
0
 private void ToggleGeometryPressed(BindState State)
 {
     if (State != BindState.Pressed)
     {
         return;
     }
     DisplayGeometry = !DisplayGeometry;
 }
Exemple #12
0
 private void TogglePerformancePressed(BindState State)
 {
     if (State != BindState.Pressed)
     {
         return;
     }
     DisplayPerformance = !DisplayPerformance;
 }
Exemple #13
0
 private void ToggleEntityPressed(BindState State)
 {
     if (State != BindState.Pressed)
     {
         return;
     }
     DisplayEntities = !DisplayEntities;
 }
Exemple #14
0
 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);
     }
 }
Exemple #16
0
 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();
     }
 }
Exemple #18
0
        public void Unbind()
        {
            if (IsBind)
            {
#if DEBUG
                BindState.Get().SetBoundFrameBuffer("");
#endif
                GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0);
                bBind = false;
            }
        }
Exemple #19
0
 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();
     }
 }
Exemple #21
0
 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);
         }
     }
 }
Exemple #23
0
 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);
        }
Exemple #25
0
        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();
        }
Exemple #26
0
 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);
         }
     }
 }
Exemple #27
0
    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();
        }
    }
Exemple #28
0
 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;
         }
     }
 }
Exemple #29
0
        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;
            }
        }
Exemple #30
0
 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();
         }
     }
 }
Exemple #31
0
 private void TogglePerformancePressed(BindState State)
 {
     if(State != BindState.Pressed)
         return;
     DisplayPerformance = !DisplayPerformance;
 }
Exemple #32
0
 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();
 }
Exemple #33
0
 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;
     }
 }
Exemple #34
0
 private void JumpPressed(bool isMultijump, BindState State)
 {
     if (CorvusGame.Instance.StateManager.GetCurrentState() != CorvusGame.Instance.SceneManager)
         return;
     if(State == BindState.Pressed)
         PlayerControlComponent.Jump(isMultijump);
 }
Exemple #35
0
 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;
     }
 }
Exemple #36
0
        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();
        }
Exemple #37
0
 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();
     }
 }
Exemple #38
0
 private void PausedSelect(BindState state)
 {
     if (CorvusGame.Instance.StateManager.GetCurrentState() != CorvusGame.Instance.PausedState)
         return;
     if (state == BindState.Pressed)
         CorvusGame.Instance.PausedState.ControlManager.SelectControl();
 }
Exemple #39
0
 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);
     }
 }
Exemple #40
0
 /// <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);
 }
Exemple #41
0
 private void ClearCameraPressed(BindState State)
 {
     if(State != BindState.Pressed)
         return;
     if(!CurrentCamera.IsDisposed)
         CurrentCamera.Dispose();
     Player.Character.Components.Add((CurrentCamera = new ChaseCameraComponent(Player.Camera)));
 }
Exemple #42
0
 private void ReloadPressed(BindState State)
 {
     if(State != BindState.Pressed)
         return;
     ReloadLevel();
 }
Exemple #43
0
 private void ToggleEntityPressed(BindState State)
 {
     if(State != BindState.Pressed)
         return;
     DisplayEntities = !DisplayEntities;
 }
Exemple #44
0
 private void ToggleGeometryPressed(BindState State)
 {
     if(State != BindState.Pressed)
         return;
     DisplayGeometry = !DisplayGeometry;
 }