Skip to content

Commit

Permalink
#1 New OOP structure so the dog and its clones can inherit animator b…
Browse files Browse the repository at this point in the history
…ehaviour
  • Loading branch information
Yisas committed Mar 14, 2017
1 parent 274ec13 commit 5f0c3a2
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 1,890 deletions.
25 changes: 25 additions & 0 deletions Assets/AnimatedDog.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AnimatedDog : MonoBehaviour {

protected Animator m_Animator;
protected Rigidbody rigidbody;

public float walkAnimSpeed;

protected void Start()
{
// Setup added references
m_Animator = GetComponentInChildren<Animator>();
}

protected void UpdateAnimator()
{
m_Animator.SetFloat("walkingSpeedMultiplier", walkAnimSpeed);
Vector3 tempVector = rigidbody.velocity;
tempVector.y = 0;
m_Animator.SetFloat("walkingSpeed", tempVector.magnitude);
}
}
12 changes: 12 additions & 0 deletions Assets/AnimatedDog.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5f0c3a2

Please sign in to comment.