Commit 2122d06a authored by Tanner Grehawick's avatar Tanner Grehawick

walk animation

parent b580c2a4
No preview for this file type
......@@ -40,9 +40,6 @@ public class Dash : AbstractBehavior {
Activate();
}
UpdateUI();
if (isDashing) {
print(walk.enabled);
}
}
// Should be called every frame
......@@ -110,7 +107,7 @@ public class Dash : AbstractBehavior {
// Wait
yield return new WaitForEndOfFrame();
}
if (walk != null) {
walk.enabled = true;
}
......
......@@ -12,7 +12,7 @@ public abstract class AbstractBehavior : MonoBehaviour {
protected Rigidbody2D body;
protected virtual void Awake(){
animator = GetComponent<Animator> ();
animator = GetComponentInChildren<Animator> ();
animator.logWarnings = false;
inputState = GetComponent<InputState> ();
collisionState = GetComponent<CollisionState>();
......
......@@ -19,8 +19,11 @@ public class Walk : AbstractBehavior {
private float rightTime = 0;
private float leftTime = 0;
// Use this for initialization
void Start() {
void Update() {
Vector2 vel = body.velocity;
float hspeed = Mathf.Abs(vel.x / speed);
animator.SetFloat("horizontal speed", hspeed);
print(hspeed);
}
// Update is called once per frame
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment