private void UpdateIsWall()
 {
     if (!isWall)
     {
         isWall = IsWall();
         if (isWall)
         {
             if (playerDirection.IsRight())
             {
                 isWallDirection = 1;
             }
             else if (playerDirection.IsLeft())
             {
                 isWallDirection = -1;
             }
         }
     }
     if (isWall)
     {
         if (isWallDirection == 1 && playerDirection.IsRight())
         {
             speed = 0;
         }
         else if (isWallDirection == -1 && playerDirection.IsLeft())
         {
             speed = 0;
         }
         else
         {
             isWall = false;
         }
     }
 }
Beispiel #2
0
 private void CheckAngle()
 {
     if (childDirection.IsRight())
     {
         entity.transform.Angle = 360;
     }
     else if (childDirection.IsLeft())
     {
         entity.transform.Angle = 180;
     }
 }
Beispiel #3
0
        private bool IsChildForward()
        {
            bool isCollide = collider.IsThrough("Squirrel");

            if (!isCollide)
            {
                return(false);
            }
            Vector2 otherP    = collider.GetOtherEntity("Squirrel").transform.Position;
            Vector2 thisP     = entity.transform.Position;
            bool    isForward = thisP.X.CompareTo(otherP.X) == -1 && childDirection.IsRight() ||
                                thisP.X.CompareTo(otherP.X) == 1 && childDirection.IsLeft();

            return(isCollide && isForward);
        }
Beispiel #4
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;
        }
Beispiel #5
0
        public override void Active()
        {
            base.Active();
            //TODO 更新コンテナに自分を入れる

            player         = EntityManager.FindWithTag("Player")[0];
            childDirection = (C_Switch3)entity.GetNormalComponent("C_Switch3");
            state          = (C_CharaState)entity.GetNormalComponent("C_CharaState");
            bezierPoint    = (C_BezierPoint)entity.GetNormalComponent("C_BezierPoint");
            childState     = (C_ChildState)entity.GetNormalComponent("C_ChildState");
            energy         = (C_Energy)entity.GetNormalComponent("C_Energy");
            collider       = entity.GetColliderComponent("Squirrel");
            draw           = (C_DrawAnimetion)entity.GetDrawComponent("C_DrawAnimetion");
            restExpend     = energy.GetLimitEnery() / 60 / 50; //50秒で体力尽き
            moveExpend     = energy.GetLimitEnery() / 60 / 20 + restExpend;


            if (childDirection.IsRight())
            {
                entity.transform.Angle = 360;
            }
            else if (childDirection.IsLeft())
            {
                entity.transform.Angle = 180;
            }
            else if (childDirection.IsNone())
            {
                entity.transform.Angle = 360;
            }
        }
        public override void Active()
        {
            base.Active();
            //TODO 更新コンテナに自分を入れる

            player         = EntityManager.FindWithTag("Player")[0];
            childDirection = (C_Switch3)entity.GetNormalComponent("C_Switch3");
            bezierPoint    = (C_BezierPoint)entity.GetNormalComponent("C_BezierPoint");
            state          = (C_CharaState)entity.GetNormalComponent("C_CharaState");

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

            JumpingMove();
        }
        private void Jump()
        {
            JumpingMove();
            CheckLand();

            //速度更新
            currentJumpPower += 1.2f;
            speed            *= 0.98f;
            if (speed <= 0.01f)
            {
                speed = 0;
            }

            //角度補間(空中姿勢調整)
            if (childDirection.IsRight())
            {
                entity.transform.Angle = entity.transform.Angle >= 360 ? 360 : entity.transform.Angle * 1.002f;
            }
            else if (childDirection.IsLeft())
            {
                entity.transform.Angle = entity.transform.Angle <= 180 ? 180 : entity.transform.Angle * 0.998f;
            }
        }
Beispiel #8
0
        private void Jump()
        {
            CheckSpeed();
            JumpingMove();
            CheckLand();

            //速度更新
            currentJumpPower += 1.2f;
            speed            *= 0.98f;
            if (Math.Abs(speed) <= 0.05f)
            {
                SetStop();
            }

            //角度補間(空中姿勢調整)
            if (playerDirection.IsRight())
            {
                entity.transform.Angle = entity.transform.Angle >= 360 ? 360 : entity.transform.Angle * 1.003f;
            }
            else if (playerDirection.IsLeft())
            {
                entity.transform.Angle = entity.transform.Angle <= 180 ? 180 : entity.transform.Angle * 0.995f;
            }
        }
Beispiel #9
0
        protected override void Initialize(Entity entity)
        {
            playerAnim      = (C_DrawAnimetion)entity.GetDrawComponent("C_DrawAnimetion");
            playerDirection = (C_Switch3)entity.GetNormalComponent("C_Switch3");

            Vector2 offset = Vector2.Zero;

            if (playerDirection.IsRight())
            {
                offset = new Vector2(100, -110);
            }
            else if (playerDirection.IsLeft())
            {
                offset = new Vector2(-100, -110);
            }
            attackCollider = new C_Collider_Circle("PlayerAttack", offset, 50);
            entity.RegisterComponent(attackCollider);
        }
Beispiel #10
0
 private void Move()
 {
     if (childDirection.IsNone())
     {
     }
     else if (childDirection.IsRight())
     {
         if (CheckFall(true))
         {
             return;
         }
     }
     else if (childDirection.IsLeft())
     {
         if (CheckFall(false))
         {
             return;
         }
     }
     entity.transform.Position = bezierPoint.GetNowPosition();
 }
Beispiel #11
0
        public override void Active()
        {
            base.Active();
            //TODO 更新コンテナに自分を入れる

            childDirection = (C_Switch3)entity.GetNormalComponent("C_Switch3");

            if (childDirection.IsRight())
            {
                entity.transform.Angle = 360;
            }
            else if (childDirection.IsLeft())
            {
                entity.transform.Angle = 180;
            }
            else if (childDirection.IsNone())
            {
                entity.transform.Angle = 360;
            }

            moveAreaLeft  = entity.transform.Position.X;
            moveAreaRight = moveAreaLeft + 500;
        }
Beispiel #12
0
        public override void Active()
        {
            base.Active();
            //TODO 更新コンテナに自分を入れる

            childDirection = (C_Switch3)entity.GetNormalComponent("C_Switch3");
            bezierPoint    = (C_BezierPoint)entity.GetNormalComponent("C_BezierPoint");

            childDirection.SetRight(false);

            if (childDirection.IsRight())
            {
                entity.transform.Angle = 360;
            }
            else if (childDirection.IsLeft())
            {
                entity.transform.Angle = 180;
            }
            else if (childDirection.IsNone())
            {
                entity.transform.Angle = 360;
            }
        }