Esempio n. 1
0
        public override void OnEnter(AriesEntity entity, Telegram msg)
        {
            base.OnEnter(entity, msg);

            Rigidbody2D     rigid    = entity.GetAgent().GetComponent <Rigidbody2D>();
            AriesDash       dash     = entity.GetAgent().GetComponent <AriesDash>();
            Animator        animator = entity.GetAgent().GetComponent <Animator>();
            AriesAnimBridge bridge   = entity.GetAgent().GetComponent <AriesAnimBridge>();

            m_enterGravityScale = rigid.gravityScale;
            m_leftTime          = dash.m_dashKeepTime;
            animator.SetTrigger(bridge.dashTrigger);
        }
Esempio n. 2
0
        public override void FixedUpdate(AriesEntity entity, float dt)
        {
            AriesDash       dash  = entity.GetAgent().GetComponent <AriesDash>();
            Rigidbody2D     rigid = entity.GetAgent().GetComponent <Rigidbody2D>();
            AriesController ctrl  = entity.GetAgent().GetComponent <AriesController>();

            Vector3 dir = ctrl.GetFront();

            rigid.velocity = dir * dash.m_dashSpeed;

            m_leftTime -= dt;
            if (m_leftTime <= 0)
            {
                entity.ChangeState(AriesState.Fall);
            }
        }