How to stop animation

Hey. I have a problem, because when game is restarted, animation start again…

using UnityEngine;
using System.Collections;

public class GameOverManager : MonoBehaviour
{

public ColiderDestroyObject hasEnded;
Animator anim;

void Awake ()
{
anim = GetComponent ();

}

void Update ()
{

if (ColiderDestroyObject.hasEnded==true) {
anim.SetTrigger(“GameOver”);
}
}
}

Problem is resolved