Пример #1
0
        public override void OnEnter(AriesEntity entity, Telegram msg)
        {
            base.OnEnter(entity, msg);

            AriesJump   jumpComp = entity.GetAgent().GetComponent <AriesJump>();
            Rigidbody2D rigid    = entity.GetAgent().GetComponent <Rigidbody2D>();

            jumpComp.ResetForJump2();
            if (rigid.velocity.y < 0)
            {
                rigid.velocity = new Vector2(rigid.velocity.x, 0);// give a min velocity of y
            }
        }
Пример #2
0
        public override void FixedUpdate(AriesEntity entity, float dt)
        {
            AriesController     ctrl      = entity.GetAgent().GetComponent <AriesController>();
            AriesJump           jumpComp  = entity.GetAgent().GetComponent <AriesJump>();
            Rigidbody2D         rigid     = entity.GetAgent().GetComponent <Rigidbody2D>();
            EnvironmentDetector envDector = entity.GetAgent().GetComponent <EnvironmentDetector>();

            Vector2 curVelocity = rigid.velocity;

            if (curVelocity.y < 0)
            {
                entity.ChangeState(AriesState.Fall);
            }
        }
Пример #3
0
        public override void Update(AriesEntity entity, float dt)
        {
            AriesController     ctrl      = entity.GetAgent().GetComponent <AriesController>();
            AriesJump           jumpComp  = entity.GetAgent().GetComponent <AriesJump>();
            Rigidbody2D         rigid     = entity.GetAgent().GetComponent <Rigidbody2D>();
            EnvironmentDetector envDector = entity.GetAgent().GetComponent <EnvironmentDetector>();

            ctrl.UpdateHorizontalMove();

            if (ctrl.m_jumpButton.IsHold() &&
                jumpComp.GetLeftAvailableHoldDurationForJump2() > 0 &&
                !jumpComp.HasJumpBtnReleased())
            {
                jumpComp.UpdateJump2(dt);
            }
        }
Пример #4
0
        public override void Update(AriesEntity entity, float dt)
        {
            if (m_bShallChangeToIdle)
            {
                entity.ChangeState(AriesState.Idle);
                return;
            }

            AriesController ctrl     = entity.GetAgent().GetComponent <AriesController>();
            AriesJump       jumpComp = entity.GetAgent().GetComponent <AriesJump>();

            ctrl.UpdateHorizontalMove();

            //bool bCtrlJump = ctrl.m_jumpButton.IsPress() || ctrl.m_jumpButton.IsHold();
            bool bCtrlJump = ctrl.m_jumpButton.IsPress();

            if (bCtrlJump && jumpComp.CheckJumpChance())
            {
                m_jumpComp.UpdateJump2(dt);
                entity.ChangeState(AriesState.Jump2);
            }
        }
Пример #5
0
        public override bool HandleMessage(AriesEntity entity, Telegram msg)
        {
            bool bHandled = true;

            switch (msg.m_msgType)
            {
            case MessageType.MT_TryDash:
            {
                m_jumpComp = entity.GetAgent().GetComponent <AriesJump>();
                if (m_jumpComp.GetDashCount() == 0)
                {
                    m_jumpComp.AddDashCount();
                    entity.ChangeState(AriesState.Dash);
                }
                break;
            }

            default:
                bHandled = false;
                break;
            }
            return(bHandled);
        }
Пример #6
0
 public AriesStateFall(AriesEntity entity) : base(entity)
 {
     m_envDetector = entity.GetAgent().GetComponent <EnvironmentDetector>();
     m_jumpComp    = entity.GetAgent().GetComponent <AriesJump>();
 }
Пример #7
0
 public AriesStateIdle(AriesEntity entity) : base(entity)
 {
     m_jump = entity.GetAgent().GetComponent <AriesJump>();
 }
Пример #8
0
 public AriesStateJump1(AriesEntity entity) : base(entity)
 {
     m_jumpComp    = entity.GetAgent().GetComponent <AriesJump>();
     m_rigid       = entity.GetAgent().GetComponent <Rigidbody2D>();
     m_envDetector = entity.GetAgent().GetComponent <EnvironmentDetector>();
 }