Exemple #1
0
 void Update()
 {
     if (start)
     {
         transform.Translate(Time.deltaTime * speed, 0, 0);
         GameObject zombie = search.SearchClosestZombie(row, 0, range);
         if (zombie)
         {
             zombie.GetComponent <ZombieHealth>().Damage(10000);
             StartCoroutine(Stop());
         }
         if (transform.position.x > (StageMap.RightGrid + 3.5f))
         {
             Destroy(gameObject);
         }
     }
     else
     {
         if (search.isZombieInRange(row, 0, range))
         {
             start = true;
             AudioManager.GetInstance().PlaySound(sound);
         }
     }
 }
    void Update()
    {
        if (_cdTimer > 0 && enabled)
        {
            _cdTimer -= Time.deltaTime;
        }
        else

        {
            bool hasZombie = _search.isZombieInRange(_grow.Row, 0, Range);

            if (!hasZombie)
            {
                return;
            }
            StartCoroutine("shoot");

            _cdTimer = Cd;
        }
    }