No errors but no work...

Hi guys im doing a rpg type game and now i hv 2 scripts one for enemy and another for attack… wts happen here is that whn i attack enemy the impact method is not working propertly and so enemy dont take damage… can anyone help me plz?

here are the 2 scripts…

using UnityEngine;
using System.Collections;

public class Mob : MonoBehaviour
[code=CSharp]using UnityEngine;
using System.Collections;

public class Fighter : MonoBehaviour
{
    public GameObject opponent;

    public AnimationClip attack;

    public int damage;

    public double impactTime;
    public bool impacted;

    // Use this for initialization
    void Start ()
    {
   
    }
   
    // Update is called once per frame
    void Update ()
    {
        if (Input.GetKey (KeyCode.Space))
        {
            animation.Play(attack.name);   
            ClickToMove.attack = true;

            if(opponent!=null)
            {
                transform.LookAt(opponent.transform.position);
            }
        }

        if (!animation.IsPlaying(attack.name))
        {
            ClickToMove.attack = false;
            impacted = false;
        }

        impact();
    }

    void impact()
    {
        if (opponent!= null&&animation.IsPlaying(attack.name)&&!impacted)
        {
            if((animation[attack.name].time)>(animation[attack.name].length+impactTime))
            {
                opponent.GetComponent<Mob>().getHit(damage);
                impacted = true;
            }
        }
    }
}

{
public float speed;
public float range;
public CharacterController controller;

public Transform player;

public AnimationClip idle;
public AnimationClip run;

private int health;

// Use this for initialization
void Start ()
{
health = 100;
}

// Update is called once per frame
void Update ()
{
if (!inRange ())
{
chase ();
Debug.Log (health);
}
else
{
animation.CrossFade(idle.name);
}
}

bool inRange()
{
if (Vector3.Distance (transform.position, player.position) < range)
{
return true;
}
else
{
return false;
}
}

void chase()
{
transform.LookAt (player.position);
controller.SimpleMove (transform.forward * speed);
animation.CrossFade (run.name);
}

public void getHit(int damage)
{
health = health - damage;

}

void OnMouseOver()
{
player.GetComponent ().opponent = gameObject;
}
}

[/code]

sry the 2nd enters wrong there he is

using UnityEngine;
using System.Collections;

public class Fighter : MonoBehaviour
{
    public GameObject opponent;

    public AnimationClip attack;

    public int damage;

    public double impactTime;
    public bool impacted;

    // Use this for initialization
    void Start ()
    {
   
    }
   
    // Update is called once per frame
    void Update ()
    {
        if (Input.GetKey (KeyCode.Space))
        {
            animation.Play(attack.name);   
            ClickToMove.attack = true;

            if(opponent!=null)
            {
                transform.LookAt(opponent.transform.position);
            }
        }

        if (!animation.IsPlaying(attack.name))
        {
            ClickToMove.attack = false;
            impacted = false;
        }

        impact();
    }

    void impact()
    {
        if (opponent!= null&&animation.IsPlaying(attack.name)&&!impacted)
        {
            if((animation[attack.name].time)>(animation[attack.name].length+impactTime))
            {
                opponent.GetComponent<Mob>().getHit(damage);
                impacted = true;
            }
        }
    }
}

Its fixed… Ty anyway.