Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public virtual void Movement()
- {
- if (!isAttack)
- {
- if (Controls.GetAxis(Horizontal) != 0)
- {
- speed = Mathf.Clamp(speed + (speedrate * Time.deltaTime), 0, maxspeed);
- transform.rotation = Quaternion.AngleAxis(180 * (Controls.GetAxis(Horizontal) < 0).CompareTo(false), Vector3.up);
- facing = Controls.GetAxis(Horizontal);
- }
- else
- {
- speed = Mathf.Clamp(speed - (speedrate * Time.deltaTime), 0, maxspeed);
- }
- if (Controls.GetAxis(Horizontal) > 0)
- {
- isFacing = Mathf.Min(isFacing + (turnrate * Time.deltaTime), 1);
- }
- if (Controls.GetAxis(Horizontal) < 0)
- {
- isFacing = Mathf.Max(isFacing - (turnrate * Time.deltaTime), -1);
- }
- } else
- {
- speed = 0;
- }
- rb.velocity = new Vector3((speed * isFacing), rb.velocity.y);
- Jumping();
- }
- public virtual void Jumping()
- {
- if (Controls.GetButtonDown(A) && isOnFloor && Controls.GetAxis(Vertical) >= 0 && (notPlaying("uu", "dd", "aa", "adb")))
- {
- if (lastmove == "")
- lastmove = anim.CurrentClip.name;
- isAttack = false;
- jump = maxjump;
- downstep = 0;
- upstep = 0;
- }
- if (!isAttack)
- {
- if (!isOnFloor && jump > jumprate*-1.5)
- {
- jump -= jumprate * Time.deltaTime;
- }
- if ((Controls.GetButtonUp(A) && jump > 0) || (isOnFloor && jump < 0))
- {
- jump = 0;
- }
- } else
- {
- jump = 0;
- }
- rb.velocity = new Vector3(rb.velocity.x, jump);
- }
- public virtual void Animations()
- {
- if (!isAttack)
- {
- if (!isOnFloor)
- {
- if (jump > 0)
- {
- playThis("jump");
- }
- if (jump < 0)
- {
- playThis("fall");
- }
- }
- else
- {
- if (Controls.GetAxis(Horizontal) == 0)
- {
- playThis("idle");
- }
- else
- {
- playThis("run");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement