Animations

I am trying to make a game but I don’t know how to make an object start a specific animation when a certain event happens, there are multiple animations that I have for the object and if the player were to do another thing I want the object to do a different animation

pseudo-code

    switch(PlayerState) {
    case "idle" : animation.CrossFade(idleAnimation,.5f); break;
    case "walk" : animation.CrossFade (walkAnimation,.5f); break;
    case "run" : animation.CrossFade (runAnimation,.5f); break;
...
    }

I’m assuming you are using Legacy Animations. Read more here
http://docs.unity3d.com/Documentation/Manual/AnimationScripting40.html