Пример #1
0
 void Update()
 {
     object[] zombies = search.SearchZombieInRange(grow.row, -range, range);
     if (zombies.Length != 0)
     {
         foreach (GameObject zombie in zombies)
         {
             zombie.GetComponent <ZombieHealthy>().DieByMine();
         }
         animator.SetTrigger("boom");
         GameObject eff = Instantiate(effect);
         eff.transform.position = transform.position + effectOffset;
         eff.GetComponent <SpriteRenderer>().sortingOrder = transform.Find("plant")
                                                            .GetComponent <SpriteRenderer>()
                                                            .sortingOrder + 1;
         Destroy(eff, destroyTime);
         AudioManager.GetInstance().PlaySound(explodeSound);
         Invoke("DoDestroy", destroyTime);
         enabled = false;
     }
 }
Пример #2
0
 void Update()
 {
     if (start)
     {
         transform.Translate(Time.deltaTime * speed, 0, 0);
         object[] zombies = search.SearchZombieInRange(row, 0, range);
         foreach (GameObject zombie in zombies)
         {
             zombie.GetComponent <ZombieHealthy>().Damage(10000);
         }
         if (transform.position.x > (StageMap.GRID_RIGTH + 0.5f))
         {
             Destroy(gameObject);
         }
     }
     else
     {
         if (search.IsZombieInRange(row, 0, range))
         {
             start = true;
             AudioManager.GetInstance().PlaySound(sound);
         }
     }
 }