예제 #1
0
        protected override eStateTrans UpdateAction(Entity entity, ref IState <Entity> nextState)
        {
            if (state.IsJump)
            {
                entity.RemoveComponent(moveComp);
                UpdateComponent fallComp = new C_JumpWithSquirrelAI(Parameter.PlayerLimitSpeed);
                entity.RegisterComponent(fallComp);
                nextState = new JumpState_Com_Squirrel(gameDevice);
                return(eStateTrans.ToNext);
            }

            //Damage判定
            if (CollitionCheck(entity))
            {
                nextState = new DeathState_Com("Bom", gameDevice);
                return(eStateTrans.ToNext);
            }

            nextState = this;
            return(eStateTrans.ToThis);
        }
예제 #2
0
        protected override eStateTrans UpdateAction(Entity entity, ref IState <Entity> nextState)
        {
            //下ジャンプに遷移
            if (JumpDownCheck(entity))
            {
                routeEffect.Sleep();
                float nowSpeed = moveComp.speed;
                entity.RemoveComponent(moveComp);
                nextState = new JumpState_Com_Player(gameDevice, eJumpType.Down, nowSpeed);
                return(eStateTrans.ToNext);
            }

            //落下に遷移
            if (state.IsJump)
            {
                routeEffect.Sleep();
                float nowSpeed = moveComp.speed;
                entity.RemoveComponent(moveComp);
                nextState = new JumpState_Com_Player(gameDevice, eJumpType.Fall, nowSpeed);
                return(eStateTrans.ToNext);
            }

            //Jumpに遷移
            if (inputState.WasDown(Keys.Space, Buttons.A))
            {
                //子生物誘導ヒントを作る
                C_Collider_PointInHintArea hint = new C_Collider_PointInHintArea("ChildJump", entity.transform.Position, Vector2.One * 40);
                hint.Active();
                hint.Destroy(2);
                TaskManager.AddTask(hint);

                routeEffect.Sleep();
                float nowSpeed = moveComp.speed;
                entity.RemoveComponent(moveComp);
                nextState = new JumpState_Com_Player(gameDevice, eJumpType.Up, nowSpeed);
                return(eStateTrans.ToNext);
            }


            //攻撃
            if (inputState.IsDown(Keys.F, Buttons.B))
            {
                routeEffect.Sleep();
                entity.RemoveComponent(moveComp);
                nextState = new AttackState_Com_Player(gameDevice);
                return(eStateTrans.ToNext);
            }

            //Skill選択に遷移
            if (inputState.WasDown(Keys.Z, Buttons.LeftShoulder))
            {
                routeEffect.Sleep();
                entity.RemoveComponent(moveComp);
                nextState = new SkillSelect_Com(gameDevice);
                return(eStateTrans.ToNext);
            }

            //Damage判定
            if (CollitionCheck(entity))
            {
                entity.RemoveComponent(moveComp);
                collider.DeActive();
                nextState = new DeathState_Com("Bom", gameDevice);
                return(eStateTrans.ToNext);
            }

            //Skill発動
            if (seasonState.IsCanSkill() && inputState.WasDown(Keys.X, Buttons.RightShoulder))
            {
                DrawComponent drawSkill = new C_DrawSkillCircle(true, 100);
                entity.RegisterComponent(drawSkill);

                ColliderComponent skillCollider = new C_Collider_Circle("PlayerSkill", new Vector2(0, -120), 400);
                entity.RegisterComponent(skillCollider);
                skillCollider.Destroy(3);

                seasonState.CoolingSkill();
            }

            nextState = this;
            return(eStateTrans.ToThis);
        }