private Sprite[] subSprites; // All the consituent sprites #endregion Fields #region Methods // Set the animation state public void AnimateMe(NPCmove dir, bool move) { characterAnimator.SetInteger("Direction", (int)dir); characterAnimator.SetBool ("Moving", move); }
// Set the next target waypoint public void SetTarget() { // Figure out the direction of movement for the animation controller Vector3 direction = Vector3.ClampMagnitude(nextWaypoint.location - currentWaypoint.location, 1) / Vector3.ClampMagnitude(nextWaypoint.location - currentWaypoint.location, 1).magnitude; if (direction.y > 0) moveDir = NPCmove.North; else if (direction.y < 0) moveDir = NPCmove.South; else if (direction.x > 0) moveDir = NPCmove.East; else moveDir = NPCmove.West; //Debug.Log ("Seeking: " + nextWaypoint); }