コード例 #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
                }
            }
        }
コード例 #2
0
 private void ShootPlayer(BindState state)
 {
     if (state == BindState.Pressed)
     {
         PCC.Shoot("Sprites/Misc/arrow");
     }
 }
コード例 #3
0
 private void TakeHealth(BindState state)
 {
     if (state == BindState.Pressed)
     {
         PCC.DecreaseHealth();
     }
 }
コード例 #4
0
 private void GiveHealth(BindState state)
 {
     if (state == BindState.Pressed)
     {
         PCC.IncreaseHealth();
     }
 }
コード例 #5
0
 private void CloseGame(BindState state)
 {
     if (state == BindState.Pressed)
     {
         this.Exit();
     }
 }
コード例 #6
0
 private void ToggleViewEntities(BindState state)
 {
     if (state == BindState.Pressed)
     {
         Debugger.ToggleViewEntities(this.GetGameState <SceneManager>().ActiveScene);
     }
 }
コード例 #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);
            }
        }
コード例 #8
0
 private void ResetScene(BindState state)
 {
     if (state == BindState.Pressed)
     {
         ScrollerSerializer.ReloadEntities();
         this.GetGameState <SceneManager>().ReloadScenes("", true);
     }
 }
コード例 #9
0
ファイル: DebugComponent.cs プロジェクト: Octanum/Corvus
 private void ReloadPressed(BindState State)
 {
     if (State != BindState.Pressed)
     {
         return;
     }
     ReloadLevel();
 }
コード例 #10
0
        public void Bind()
        {
#if DEBUG
            BindState.Get().SetBoundFrameBuffer(DebugName);
#endif
            GL.BindFramebuffer(FramebufferTarget.Framebuffer, frameBufferObject);
            bBind = true;
        }
コード例 #11
0
ファイル: DebugComponent.cs プロジェクト: Octanum/Corvus
 private void ToggleGeometryPressed(BindState State)
 {
     if (State != BindState.Pressed)
     {
         return;
     }
     DisplayGeometry = !DisplayGeometry;
 }
コード例 #12
0
ファイル: DebugComponent.cs プロジェクト: Octanum/Corvus
 private void TogglePerformancePressed(BindState State)
 {
     if (State != BindState.Pressed)
     {
         return;
     }
     DisplayPerformance = !DisplayPerformance;
 }
コード例 #13
0
ファイル: DebugComponent.cs プロジェクト: Octanum/Corvus
 private void ToggleEntityPressed(BindState State)
 {
     if (State != BindState.Pressed)
     {
         return;
     }
     DisplayEntities = !DisplayEntities;
 }
コード例 #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;
         }
     }
 }
コード例 #15
0
 private void JumpPlayer(BindState state, bool allowMulti)
 {
     if (!_StateManager.IsActiveState <SceneManager>())
     {
         return;
     }
     if (state == BindState.Pressed)
     {
         PCC.Jump(allowMulti);
     }
 }
コード例 #16
0
ファイル: CorvusBinds.cs プロジェクト: Octanum/Corvus
 private void JumpPressed(bool isMultijump, BindState State)
 {
     if (CorvusGame.Instance.StateManager.GetCurrentState() != CorvusGame.Instance.SceneManager)
     {
         return;
     }
     if (State == BindState.Pressed)
     {
         PlayerControlComponent.Jump(isMultijump);
     }
 }
コード例 #17
0
 private void MovePlayer(BindState state, Direction dir)
 {
     if (state == BindState.Pressed && _StateManager.IsActiveState <SceneManager>())
     {
         PCC.BeginMove(dir);
     }
     else if (_StateManager.ContainsState <SceneManager>())
     {
         PCC.StopMove();
     }
 }
コード例 #18
0
        public void Unbind()
        {
            if (IsBind)
            {
#if DEBUG
                BindState.Get().SetBoundFrameBuffer("");
#endif
                GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0);
                bBind = false;
            }
        }
コード例 #19
0
ファイル: CorvusBinds.cs プロジェクト: Octanum/Corvus
 private void OptionsSelect(BindState state)
 {
     if (CorvusGame.Instance.StateManager.GetCurrentState() != CorvusGame.Instance.OptionsState)
     {
         return;
     }
     if (state == BindState.Pressed)
     {
         CorvusGame.Instance.OptionsState.ControlManager.SelectControl();
     }
 }
コード例 #20
0
 private void CrouchPlayer(BindState state)
 {
     if (state == BindState.Pressed && _StateManager.IsActiveState <SceneManager>())
     {
         PCC.Crouch();
     }
     else if (_StateManager.ContainsState <SceneManager>())
     {
         PCC.StopMove();
     }
 }
コード例 #21
0
ファイル: DebugComponent.cs プロジェクト: Octanum/Corvus
 private void ClearCameraPressed(BindState State)
 {
     if (State != BindState.Pressed)
     {
         return;
     }
     if (!CurrentCamera.IsDisposed)
     {
         CurrentCamera.Dispose();
     }
     Player.Character.Components.Add((CurrentCamera = new ChaseCameraComponent(Player.Camera)));
 }
コード例 #22
0
 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);
         }
     }
 }
コード例 #23
0
ファイル: CorvusBinds.cs プロジェクト: Octanum/Corvus
 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();
     }
 }
コード例 #24
0
        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);
        }
コード例 #25
0
ファイル: CorvusBinds.cs プロジェクト: Octanum/Corvus
        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();
        }
コード例 #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);
         }
     }
 }
コード例 #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();
        }
    }
コード例 #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;
         }
     }
 }
コード例 #29
0
ファイル: CorvusBinds.cs プロジェクト: Octanum/Corvus
        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;
            }
        }
コード例 #30
0
ファイル: CorvusBinds.cs プロジェクト: Octanum/Corvus
 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();
         }
     }
 }
コード例 #31
0
ファイル: DebugComponent.cs プロジェクト: Octanum/Corvus
 private void TogglePerformancePressed(BindState State)
 {
     if(State != BindState.Pressed)
         return;
     DisplayPerformance = !DisplayPerformance;
 }
コード例 #32
0
ファイル: CorvusBinds.cs プロジェクト: Octanum/Corvus
 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();
 }
コード例 #33
0
ファイル: CorvusBinds.cs プロジェクト: Octanum/Corvus
 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;
     }
 }
コード例 #34
0
ファイル: CorvusBinds.cs プロジェクト: Octanum/Corvus
 private void JumpPressed(bool isMultijump, BindState State)
 {
     if (CorvusGame.Instance.StateManager.GetCurrentState() != CorvusGame.Instance.SceneManager)
         return;
     if(State == BindState.Pressed)
         PlayerControlComponent.Jump(isMultijump);
 }
コード例 #35
0
ファイル: CorvusBinds.cs プロジェクト: Octanum/Corvus
 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;
     }
 }
コード例 #36
0
ファイル: CorvusBinds.cs プロジェクト: Octanum/Corvus
        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();
        }
コード例 #37
0
ファイル: CorvusBinds.cs プロジェクト: Octanum/Corvus
 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();
     }
 }
コード例 #38
0
ファイル: CorvusBinds.cs プロジェクト: Octanum/Corvus
 private void PausedSelect(BindState state)
 {
     if (CorvusGame.Instance.StateManager.GetCurrentState() != CorvusGame.Instance.PausedState)
         return;
     if (state == BindState.Pressed)
         CorvusGame.Instance.PausedState.ControlManager.SelectControl();
 }
コード例 #39
0
ファイル: CorvusBinds.cs プロジェクト: Octanum/Corvus
 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);
     }
 }
コード例 #40
0
ファイル: Bind.cs プロジェクト: Octanum/Corvus
 /// <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);
 }
コード例 #41
0
ファイル: DebugComponent.cs プロジェクト: Octanum/Corvus
 private void ClearCameraPressed(BindState State)
 {
     if(State != BindState.Pressed)
         return;
     if(!CurrentCamera.IsDisposed)
         CurrentCamera.Dispose();
     Player.Character.Components.Add((CurrentCamera = new ChaseCameraComponent(Player.Camera)));
 }
コード例 #42
0
ファイル: DebugComponent.cs プロジェクト: Octanum/Corvus
 private void ReloadPressed(BindState State)
 {
     if(State != BindState.Pressed)
         return;
     ReloadLevel();
 }
コード例 #43
0
ファイル: DebugComponent.cs プロジェクト: Octanum/Corvus
 private void ToggleEntityPressed(BindState State)
 {
     if(State != BindState.Pressed)
         return;
     DisplayEntities = !DisplayEntities;
 }
コード例 #44
0
ファイル: DebugComponent.cs プロジェクト: Octanum/Corvus
 private void ToggleGeometryPressed(BindState State)
 {
     if(State != BindState.Pressed)
         return;
     DisplayGeometry = !DisplayGeometry;
 }