Exemplo n.º 1
0
 private void CheckAngle()
 {
     if (childDirection.IsRight())
     {
         entity.transform.Angle = 360;
     }
     else if (childDirection.IsLeft())
     {
         entity.transform.Angle = 180;
     }
 }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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;
        }
Exemplo n.º 4
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;
            }
        }
Exemplo n.º 5
0
        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();
        }
Exemplo n.º 6
0
        private void Move()
        {
            UpdateIsWall();

            if (playerDirection.IsRight())
            {
                bezierPoint.ToRight((int)speed);
            }
            else
            {
                bezierPoint.ToLeft((int)speed);
            }

            if (bezierPoint.IsEnd())
            {
                state.IsJump = true;
                return;
            }
            bezierPoint.Rotate();
            entity.transform.Position = bezierPoint.GetNowPosition();
        }
Exemplo n.º 7
0
        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;
            }
        }
Exemplo n.º 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;
            }
        }
Exemplo n.º 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);
        }
Exemplo n.º 10
0
        protected override void UpdateMove()
        {
            if (collider.IsThrough("ChildJump") && !childDirection.IsNone())
            {
                state.IsJump = true;
            }
            if (state.IsJump)
            {
                return;
            }
            isCaught = childState.IsBeCaught();
            if (isCaught)
            {
                Entity enemy = childState.GetEnemyCaughtMe();
                if (!enemy.GetIsActive())
                {
                    entity.DeActive();
                    return;
                }
                C_Switch3 enemyDirection = (C_Switch3)enemy.GetNormalComponent("C_Switch3");
                Vector2   offset         = enemyDirection.IsRight() ? new Vector2(-20, 0) : new Vector2(20, 0);
                entity.transform.Position = enemy.transform.Position + offset;
                return;
            }

            base.UpdateMove();

            if (childState == null)
            {
                return;
            }
            if (!childState.FollowSwitch)
            {
                return;
            }

            speed = startSpeed;     // - startSpeed *(1 - energy.GetRate())* 0.5f

            CheckDirection();
            Move();
        }
Exemplo n.º 11
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();
 }
Exemplo n.º 12
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;
        }
Exemplo n.º 13
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;
            }
        }