public void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Enemy")
     {
         enemy = other.GetComponent <Vilain>();
     }
 }
    public void Update()
    {
        if (gm.isGameOver())
        {
            return;
        }
        float freq = defeated / 20f;

        if (freq > _spawnFrequency - 0.2f)
        {
            freq = _spawnFrequency - 0.2f;
        }
        _lastSpawn += Time.deltaTime;
        if (_lastSpawn > _spawnFrequency - freq && vilains < 25)
        {
            _lastSpawn = 0;
            vilains   += 1;
            int r = Random.Range(0, 100);
            if (r > 105 - (defeated / 2) && defeated > 15)
            {
                GameObject go = Instantiate(Boss);
                Vilain     v  = go.GetComponent <Vilain>();
                v.gm = gm;
                v.vm = this;
            }
            else
            {
                GameObject go = Instantiate(Common);
                Vilain     v  = go.GetComponent <Vilain>();
                v.gm = gm;
                v.vm = this;
            }
        }
    }
 public void move()
 {
     GoToVilain();
     if (_lastAttack >= frequence && enemy != null)
     {
         _lastAttack = 0;
         if (enemy.GetDamage(damage) == true)
         {
             enemy = null;
         }
     }
 }