How to create a CharacterController? (C#)

As a noob to Unity I’m trying to learn everything I can and try to find out what I like most so I can continue down that chosen path. I’m just testing out some small features with basically nothing loaded in the scene, but here’s my issue.

I downloaded a low-poly human, rigged him in Blender and created both an idle and walking animation. Imported that asset into Unity. Created a Animator Controller, added him to the player and added both animations using Mecanim. Now I’d like to create a character controller script that lets me call these individual animations on keyboard input.

So for example: when I press “w” he needs to move forward and use the walking animation. When I stop using “w” he needs to revert to idle.

Can someone point me in the right direction? I would like to create that script from the ground up so I can really understand what is going on and how I implement everything that is needed.

Edit: Basically what I’m asking for is a beginner tutorial on Mecanim, using just a couple of animations and make them work according to controller input.

Thanks in advance,

Yannick

Watch the video but it’s important you watch it all and don’t skip through it or you won’t understand and then you will not be able to do it again for future reference and then you’ll just have to watch it again haha!

http://video.unity3d.com/video/7362044/unity-40-mecanim-animation-tutorial