I can't help you correct the animation code if you remove it...
Generally speaking, once the player is within whatever distance you want, simply use animation.Play(). Read the [animation documentation](http://docs.unity3d.com/Documentation/ScriptReference/Animation.Play.html) for specifics.
If you don't know how to calculate the distance between 2 objects, [see here](https://www.google.com/search?q=unity+calculate+distance+between+two+objects&aq=1&oq=unity+calculate+dista&aqs=chrome.2.57j0l3j62.3811&sourceid=chrome&ie=UTF-8).
↧