Exemple #1
0
 private void CheckFruit()
 {
     if (collider.ThroughEnd("Fruit"))
     {
         draw.SetNowAnim("Run");
         return;
     }
     if (collider.IsThrough("Fruit"))
     {
         childDirection.SetNone();
         draw.SetNowAnim("Eat");
     }
 }
Exemple #2
0
        private void CreateSquirrel(Vector2 position)
        {
            Transform2D trans = new Transform2D();

            trans.Position = position;

            Entity child = Entity.CreateEntity("Squirrel", "Child", trans);

            child.RegisterComponent(new C_Switch3());
            child.RegisterComponent(new C_CharaState());
            child.RegisterComponent(new C_ChildState());
            C_BezierPoint bezier = new C_BezierPoint();

            child.RegisterComponent(bezier);
            BezierStage.AddBezierData(bezier);
            //child.RegisterComponent(new C_DrawDebugMessage(bezier));
            child.RegisterComponent(new C_EntityDeadCheck());
            child.RegisterComponent(new C_Energy("", 10, 90));

            C_DrawAnimetion drawComp = new C_DrawAnimetion(new Vector2(80, 60), 14);

            drawComp.AddAnim("Run", new AnimData(7, 7, 0.08f, "A_Squirrel_Run"));
            drawComp.AddAnim("Eat", new AnimData(1, 1, 1f, "A_Squirrel_Eat"));
            drawComp.AddAnim("Catch", new AnimData(1, 1, 1f, "A_Squirrel_Catch"));
            child.RegisterComponent(drawComp);
            drawComp.SetNowAnim("Run");

            child.RegisterComponent(new C_UpdateSquirrelState(gameDevice));
        }
 private void CheckAnim()
 {
     if (speed < startSpeed * 0.009f)
     {
         SetStop();
         return;
     }
     if (speed <= speedSwith)
     {
         animControl.SetNowAnim("Walk");
     }
     else
     {
         animControl.SetNowAnim("Run");
     }
 }
Exemple #4
0
        private void CreateShrub(Vector2 position)
        {
            Transform2D trans = new Transform2D();

            trans.Position = position;

            Entity shrub = Entity.CreateEntity("Tree", "Tree", trans);

            //位置設定
            shrub.RegisterComponent(new C_BezierPoint());
            shrub.RegisterComponent(new C_Switch3());

            C_DrawAnimetion drawComp = new C_DrawAnimetion(new Vector2(452, 276), 12);

            drawComp.AddAnim("Pollution", new AnimData(1, 1, 1, "A_Shrub_Pollution"));
            drawComp.AddAnim("Spring", new AnimData(1, 1, 1, "A_Shrub_Spring"));
            drawComp.AddAnim("Summer", new AnimData(1, 1, 1, "A_Shrub_Summer"));
            drawComp.AddAnim("Autumn", new AnimData(1, 1, 1, "A_Shrub_Autumn"));
            drawComp.AddAnim("Winter", new AnimData(1, 1, 1, "A_Shrub_Winter"));
            drawComp.AddAnim("Hidden", new AnimData(1, 1, 1, "A_Shrub_Hidden"));
            shrub.RegisterComponent(drawComp);
            drawComp.SetNowAnim("Pollution");

            shrub.RegisterComponent(new C_UpdateShrubState(gameDevice));
        }
Exemple #5
0
        public override void Active()
        {
            base.Active();
            //TODO 更新コンテナに自分を入れる

            playerDirection = (C_Switch3)entity.GetNormalComponent("C_Switch3");
            bezierPoint     = (C_BezierPoint)entity.GetNormalComponent("C_BezierPoint");
            state           = (C_CharaState)entity.GetNormalComponent("C_CharaState");
            state.IsJump    = true;

            animControl = (C_DrawAnimetion)entity.GetDrawComponent("C_DrawAnimetion");
            animControl.SetNowAnim("Jump");

            if (playerDirection.IsRight())
            {
                entity.transform.Angle = 330;
            }
            else if (playerDirection.IsLeft())
            {
                entity.transform.Angle = 210;
            }
            else if (playerDirection.IsNone())
            {
                entity.transform.Angle = 360;
            }

            entity.transform.SetPositionY += currentJumpPower;
        }
Exemple #6
0
 protected override void Initialize(Entity entity)
 {
     deadCheck  = (C_EntityDeadCheck)entity.GetUpdateComponent("C_EntityDeadCheck");
     eagleAnim  = (C_DrawAnimetion)entity.GetDrawComponent("C_DrawAnimetion");
     eagleState = (C_EnemyState)entity.GetNormalComponent("C_EnemyState");
     eagleAnim.SetNowAnim("Attack");
     eagleDirection = (C_Switch3)entity.GetNormalComponent("C_Switch3");
 }
Exemple #7
0
        public override void Update()
        {
            Purify();
            SpringAction();

            if (effectTimer.IsTime)
            {
                return;
            }
            effectTimer.Update();
            CreatParticleEffect();
            if (effectTimer.IsTime)
            {
                myState.SetNowSeason(nextSeason);
                drawComp.SetNowAnim(myState.GetNowSeason().ToString());
                StartAutumn();
            }
        }
 private void DoBreak()
 {
     if (isBreak)
     {
         return;
     }
     if (collider.ThroughStart("PlayerAttack"))
     {
         drawComp.SetNowAnim("Break");
         isBreak = true;
     }
 }
Exemple #9
0
        protected override eStateTrans UpdateAction(Entity entity, ref IState <Entity> nextState)
        {
            if (inputState.IsDown(Keys.F))
            {
                attackTimer.Update();
                playerAnim.SetNowAnim("Attack");

                if (attackTimer.IsTime)
                {
                    attackCollider.Destroy(0);
                    playerAnim.SetNowAnim("Idle");
                    nextState = new MoveState_Com_Player(gameDevice, 0);
                    return(eStateTrans.ToNext);
                }
                nextState = this;
                return(eStateTrans.ToThis);
            }
            else
            {
                attackCollider.Destroy(0);
                nextState = new MoveState_Com_Player(gameDevice, 0);
                return(eStateTrans.ToNext);
            }
        }
Exemple #10
0
 private void UpdateAttack(Entity entity)
 {
     if (toTarget)
     {
         entity.transform.Position += unitVelocity * speed;
     }
     else
     {
         entity.transform.Position -= unitVelocity * speed / 3;
     }
     if (toTarget && entity.transform.Position.Y > targetPosition.Y)
     {
         toTarget = !toTarget;
         eagleAnim.SetNowAnim("Fly");
     }
 }
Exemple #11
0
        private void SurrenderChild(Entity entity)
        {
            Entity child = ((C_PlayerState)entity.GetNormalComponent("C_PlayerState")).GetOneChild();

            if (child.GetName() == "Null")
            {
                return;
            }
            C_DrawAnimetion drawChild  = (C_DrawAnimetion)child.GetDrawComponent("C_DrawAnimetion");
            C_ChildState    childState = (C_ChildState)child.GetNormalComponent("C_ChildState");

            drawChild.SetNowAnim("Catch");
            Entity       eagle      = collider.GetOtherEntity("Eagle");
            C_EnemyState eagleState = (C_EnemyState)eagle.GetNormalComponent("C_EnemyState");

            eagleState.SetCaughtChild();
            childState.SetEnemyCatchMe(eagle);
        }
Exemple #12
0
        /// <summary>
        /// 初期化
        /// </summary>
        public void Initialize()
        {
            isEnd = false;
            resourceLoader.Initialize();
            totalResouceNum = resourceLoader.Count;

            resourceManager.LoadFont("HGPop");
            resourceManager.LoadTextures("A_Player_Run", "./IMAGE/Animetions/");
            for (int i = 0; i < 4; i++)
            {
                resourceManager.LoadTextures("P_Flower_" + i, "./IMAGE/Particles/");
            }
            resourceManager.LoadTextures("P_Rain", "./IMAGE/Particles/");
            resourceManager.LoadTextures("P_Leaf", "./IMAGE/Particles/");
            resourceManager.LoadEffect("PaticleShader", "./EFFECT/");
            resourceManager.LoadEffect("MaskShader", "./EFFECT/");


            entity = Entity.CreateEntity("Empty", "Empty", new Transform2D());
            entity.transform.Position = new Vector2(startX, 1020);

            entity.RegisterComponent(new C_Switch3());
            C_BezierPoint bezier = new C_BezierPoint();

            entity.RegisterComponent(bezier);

            C_DrawAnimetion drawComp = new C_DrawAnimetion(Vector2.One * 256, 16);

            drawComp.AddAnim("Run", new AnimData(13, 4, 0.02f, "A_Player_Run"));
            entity.RegisterComponent(drawComp);
            drawComp.SetNowAnim("Run");
            drawComp.SetSize(0.7f);

            C_SeasonState     season = new C_SeasonState(eSeason.Summer);
            C_DrawRouteEffect route  = new C_DrawRouteEffect();

            route.RegisterImage("P_Flower_", 4);
            route.SetState(0.02f, 10, -85);
            route.SetAliveSecond(2);
            route.SetSize(new Vector2(0.5f, 0.5f));
            entity.RegisterComponent(season);
            entity.RegisterComponent(route);
        }
Exemple #13
0
        private void CreateBoar(Vector2 position)
        {
            Transform2D trans = new Transform2D();

            trans.Position = position;

            Entity boar = Entity.CreateEntity("Boar", "Enemy", trans);

            boar.RegisterComponent(new C_Switch3());
            boar.RegisterComponent(new C_BezierPoint());
            boar.RegisterComponent(new C_EntityDeadCheck());
            boar.RegisterComponent(new C_UpdateBoarState(gameDevice));

            C_DrawAnimetion drawComp = new C_DrawAnimetion(new Vector2(320, 200), 19);

            drawComp.AddAnim("Run", new AnimData(6, 3, 0.08f, "A_Boar_Run"));
            boar.RegisterComponent(drawComp);
            drawComp.SetNowAnim("Run");
        }
Exemple #14
0
        private void CreateEagle(Vector2 position)
        {
            Transform2D trans = new Transform2D();

            trans.Position = position;

            Entity eagle = Entity.CreateEntity("Eagle", "Enemy", trans);

            eagle.RegisterComponent(new C_Switch3());
            eagle.RegisterComponent(new C_EntityDeadCheck());
            eagle.RegisterComponent(new C_UpdateEagleState(gameDevice));

            C_DrawAnimetion drawComp = new C_DrawAnimetion(new Vector2(320, 200), 19);

            drawComp.AddAnim("Fly", new AnimData(5, 3, 0.15f, "A_Eagle_Fly"));
            drawComp.AddAnim("Attack", new AnimData(1, 1, 1f, "A_Eagle_Attack"));
            eagle.RegisterComponent(drawComp);
            drawComp.SetNowAnim("Fly");
        }
Exemple #15
0
        private void CreatApple()
        {
            //実体生成
            Entity apple = Entity.CreateEntity("Apple", "Fruit", new Transform2D());

            //位置設定
            apple.transform.Position = entity.transform.Position - new Vector2(0, 100);

            apple.RegisterComponent(new C_Switch3());
            apple.RegisterComponent(new C_BezierPoint());
            apple.RegisterComponent(new C_Energy("", 10, 90));

            C_DrawAnimetion drawComp = new C_DrawAnimetion(new Vector2(38, 36), 100);

            drawComp.AddAnim("Idle", new AnimData(1, 1, 1, "A_Apple_Idle"));
            apple.RegisterComponent(drawComp);
            drawComp.SetNowAnim("Idle");

            apple.RegisterComponent(new C_UpdateFruitState(gameDevice));
        }
Exemple #16
0
        private void CreateBird(Vector2 position)
        {
            Transform2D trans = new Transform2D();

            trans.Position = position;

            Entity child = Entity.CreateEntity("Bird", "Child", trans);

            child.RegisterComponent(new C_Switch3());
            child.RegisterComponent(new C_ChildState());
            child.RegisterComponent(new C_EntityDeadCheck());
            child.RegisterComponent(new C_UpdateBirdState(gameDevice));
            //child.RegisterComponent(new C_DrawDebugMessage());

            C_DrawAnimetion drawComp = new C_DrawAnimetion(new Vector2(80, 60), 14);

            drawComp.AddAnim("Fly", new AnimData(6, 6, 0.08f, "A_Bird_Fly"));
            child.RegisterComponent(drawComp);
            drawComp.SetNowAnim("Fly");
        }
Exemple #17
0
        //チェックしながら落下処理
        private void CheckLand()
        {
            float powercut = 0;
            float cutPower = 3f;    //チェック間隔設定

            Vector2 testPosition = bezierPoint.GetNowPosition();

            //落下チェック
            while (currentJumpPower > 0)
            {
                if (currentJumpPower < cutPower)
                {
                    cutPower = currentJumpPower;
                }
                entity.transform.Position += new Vector2(0, cutPower);
                currentJumpPower          -= cutPower;
                powercut += cutPower;

                if (bezierPoint.IsEnd())
                {
                    continue;
                }
                if (testPosition == Vector2.Zero)
                {
                    continue;
                }

                if (entity.transform.Position.Y >= testPosition.Y - 10 &&
                    entity.transform.Position.Y <= testPosition.Y + 5)
                {
                    state.IsLand = true;
                    animControl.SetNowAnim("Run");
                    break;
                }
            }
            entity.transform.Position += new Vector2(0, currentJumpPower);
            currentJumpPower          += powercut;
        }
Exemple #18
0
        public void CreatPlayer()
        {
            //生成地を決める
            Transform2D trans = new Transform2D();

            trans.Position = new Vector2(500, 100);

            //実体生成
            Entity player = Entity.CreateEntity("Player", "Player", trans);

            //機能登録(順序注意 - 関連性ある)
            player.RegisterComponent(new C_Switch3());
            player.RegisterComponent(new C_CharaState());
            C_BezierPoint bezier = new C_BezierPoint();

            player.RegisterComponent(bezier);
            BezierStage.AddBezierData(bezier);
            player.RegisterComponent(new C_EntityDeadCheck());
            player.RegisterComponent(new C_PlayerState());
            player.RegisterComponent(new C_DrawRouteEffect());
            //player.RegisterComponent(new C_DrawLocus());
            player.RegisterComponent(new C_DrawDebugMessage(gameDevice, bezier));

            C_DrawAnimetion drawComp = new C_DrawAnimetion(Vector2.One * 256, 16);

            drawComp.AddAnim("Idle", new AnimData(1, 1, 1, "A_Player_Idle"));
            drawComp.AddAnim("Walk", new AnimData(4, 4, 0.12f, "A_Player_Walk"));
            drawComp.AddAnim("Jump", new AnimData(2, 3, 0.1f, "A_Player_Jump", false));
            drawComp.AddAnim("Run", new AnimData(13, 4, 0.05f, "A_Player_Run"));
            drawComp.AddAnim("Attack", new AnimData(1, 1, 1, "A_Player_Attack"));
            player.RegisterComponent(drawComp);
            drawComp.SetNowAnim("Idle");

            player.RegisterComponent(new C_Energy("Bar", 10, 270));
            player.RegisterComponent(new C_UpdatePlayerState(gameDevice));
        }
Exemple #19
0
        private void CreateBranch(Vector2 position)
        {
            Transform2D trans = new Transform2D();

            trans.Position = position;

            Entity branch = Entity.CreateEntity("Branch", "Branch", trans);

            branch.RegisterComponent(new C_Switch3());

            C_DrawAnimetion drawComp = new C_DrawAnimetion(new Vector2(30, 200), 12);

            drawComp.AddAnim("Idle", new AnimData(1, 1, 1, "A_Branch_Idle", false));
            drawComp.AddAnim("Break", new AnimData(4, 4, 0.08f, "A_Branch_Break", false));
            branch.RegisterComponent(drawComp);
            drawComp.SetNowAnim("Idle");

            //Message用
            //C_BezierPoint bezier = new C_BezierPoint();
            //branch.RegisterComponent(bezier);
            //branch.RegisterComponent(new C_DrawDebugMessage(bezier));

            branch.RegisterComponent(new C_UpdateBranchState(gameDevice));
        }