Beispiel #1
0
        public override void UpdateAbility(StateBase sb, Animator anim, AnimatorStateInfo animStateInfo)
        {
            Movement _charMovement = sb.GetCharMovement(anim);

            //float hAxis = Input.GetAxisRaw("Horizontal");


            if (!_charMovement.moveLeft && !_charMovement.moveRight)
            {
                anim.SetBool(TransitionParameter.Move.ToString(), false);
                anim.SetBool(TransitionParameter.Jump.ToString(), false);
                _charMovement.jump = false;
                return;
            }

            if (_charMovement.moveRight && _charMovement.moveLeft)
            {
                anim.SetBool(TransitionParameter.Move.ToString(), false);
                anim.SetBool(TransitionParameter.Jump.ToString(), false);
                _charMovement.jump = false;
                return;
            }


            if (_charMovement.moveRight && !_charMovement.moveLeft)
            {
                _charMovement.SR.flipX = false;
                _charMovement.transform.Translate((speed * Time.deltaTime * animCurve.Evaluate(animStateInfo.normalizedTime)), 0, 0);
                // _charMovement.Rigid.velocity = new Vector2((hAxis * speed * Time.deltaTime), _charMovement.Rigid.velocity.y);
            }

            if (_charMovement.moveLeft && !_charMovement.moveRight)
            {
                _charMovement.SR.flipX = true;
                _charMovement.transform.Translate((-speed * Time.deltaTime * animCurve.Evaluate(animStateInfo.normalizedTime)), 0, 0);
                //_charMovement.Rigid.velocity = new Vector2((hAxis * speed * Time.deltaTime), _charMovement.Rigid.velocity.y);
            }
        }
Beispiel #2
0
        public override void UpdateAbility(StateBase sb, Animator anim, AnimatorStateInfo animStateInfo)
        {
            Movement _charMovement = sb.GetCharMovement(anim);

            if (_charMovement.moveRight && _charMovement.moveLeft)
            {
                anim.SetBool(TransitionParameter.Move.ToString(), false);
                anim.SetBool(TransitionParameter.Jump.ToString(), false);
                _charMovement.jump = false;
                return;
            }

            if (_charMovement.jump && !_charMovement.onLadder)
            {
                anim.SetBool(TransitionParameter.Jump.ToString(), true);
                anim.SetBool(TransitionParameter.Grounded.ToString(), false);
                _charMovement.Rigid.AddForce(Vector2.up * jumpForce, ForceMode2D.Impulse);
            }
            else
            {
                return;
            }
        }
 public override void OnStart(StateBase sb, Animator anim, AnimatorStateInfo animStateInfo)
 {
     Movement _charMovement = sb.GetCharMovement(anim);
 }
 public override void OnExit(StateBase sb, Animator anim, AnimatorStateInfo animStateInfo)
 {
 }
Beispiel #5
0
        public override void OnStart(StateBase sb, Animator anim, AnimatorStateInfo animStateInfo)
        {
            Movement _charMovement = sb.GetCharMovement(anim);

            _charMovement.Rigid.gravityScale = 0;
        }
Beispiel #6
0
 public abstract void OnStart(StateBase sb, Animator anim, AnimatorStateInfo animStateInfo);
Beispiel #7
0
 public abstract void UpdateAbility(StateBase sb, Animator anim, AnimatorStateInfo animStateInfo);