Need help with Animation and the Script to it

Hello,

I am doing a side scroll game for my Coursework and I got a favour or a question.

I am using the “Unity 4.0 - Mecanim Animation Tutorial” with the provided animations and scrip. The thing I currently got is a run forward animation and walk backwards.

I am just starting with Unity and coding so If anyone would help me I would much appreciated.

Starting of, here is the script that I edit a little to work for side scroll game.

using UnityEngine;
using System.Collections;

// Require these components when using this script
[RequireComponent(typeof (Animator))]
[RequireComponent(typeof (CapsuleCollider))]
[RequireComponent(typeof (Rigidbody))]
public class BotControlScript : MonoBehaviour
{
	public float animSpeed = 3f;				// a public setting for overall animator animation speed
	public float lookSmoother = 5f;				// a smoothing setting for camera motion
	public bool useCurves;						// a setting for teaching purposes to show use of curves

	
	private Animator anim;							// a reference to the animator on the character
	private AnimatorStateInfo currentBaseState;			// a reference to the current state of the animator, used for base layer
	private CapsuleCollider col;					// a reference to the capsule collider of the character
	

	static int idleState = Animator.StringToHash("Base Layer.Idle");	
	static int locoState = Animator.StringToHash("Base Layer.Locomotion");			// these integers are references to our animator's states
	

	void Start ()
	{
		// initialising reference variables
		anim = GetComponent<Animator>();					  
		col = GetComponent<CapsuleCollider>();				
	}
	
	
	void FixedUpdate ()
	{
		float v = Input.GetAxis("Horizontal");				// setup v variables as our vertical input axis
		anim.SetFloat("Speed", v);							// set our animator's float parameter 'Speed' equal to the vertical input axis					
		anim.speed = animSpeed;								// set the speed of our animator to the public variable 'animSpeed'
	}
}

Here are the pictures of the Animator controller and how it currently works:

Animator controller

Walk/Run Forward when pressing “D” or “Right Arrow”
1202669--48293--$foreward.jpg

Walk Backwards when pressing “A” or “Left Arrow”
1202669--48294--$backwards.jpg

What I want you to help me with is to transform/rotate the animation of run forward so when I am pressing the “A” or “Left Arrow” the animation RUN is going to occur and it will be facing left side, just like following picture (so the character and the animation is going to rotate from original X:0 Y:90 Z:0 into X:0 Y:-90 Z:0

Walk Backwards when pressing “A” or “Left Arrow”
1202669--48299--$left.jpg

If anyone could help me with the problem that I am facing. Is there any simple code that can be added or changed that will make the animation of run right transform, into run left.

I have been looking at some of the tutorials and other people codes and tried following, unfortunately it did not work.

	void FixedUpdate ()
	{
		if (Input.GetKeyDown(KeyCode.A))
		{
			anim.SetFloat("Speed", v);			
			anim.speed = animSpeed;
		}
		
		if (Input.GetKeyDown(KeyCode.D))
		{
			anim.SetFloat("Speed", v);			
			anim.speed = animSpeed;
			transform.eulerAngles = Vector3(0, -90, 0);
		}
	}
}

If anyone could kindly help me with this. I would be much appreciated.
Regards,
Lukasz. KRight Arrow

I am also wondering if there is any chance to edit the animation itself (like in 3Ds Max) and rotate it and then save it?