void Update() { transform.Translate(speed * Time.deltaTime, 0, 0); if (_row < 0 || StageMap.ROW_MAX <= _row) { target = null; } else if (rightward) { target = search.SearchClosetZombie(_row, 0, range); } else { target = search.SearchClosetZombie(_row, -range, 0); } if (target) { target.GetComponent <ZombieHealthy>().Damage(atk); HitEffect(); } if (!Camera.main.pixelRect.Contains(Camera.main.WorldToScreenPoint(transform.position))) { HitEffect(); } }
public override void Damage(int val) { base.Damage(val); GameObject zombie = search.SearchClosetZombie(grow.row, 0, StageMap.GRID_WIDTH); if (zombie) { bool upward; switch (grow.row) { case 0: upward = false; break; case (StageMap.ROW_MAX - 1): upward = true; break; default: upward = (Random.Range(0f, 1f) < 0.5); break; } zombie.GetComponent <ZombieMove>().ChangeRow(upward); } }
public override void Die() { base.Die(); GameObject zombie = search.SearchClosetZombie(grow.row, 0, StageMap.GRID_WIDTH); if (zombie) { // TODO zombie.GetComponent <ZombieHealthy>().BoomDie(); } }
void Update() { transform.Translate(speed * Time.deltaTime, 0, 0); if (_row < 0 || StageMap.ROW_MAX <= _row) { target = null; } target = search.SearchClosetZombie(_row, 0, range); if (target) { target.GetComponent <ZombieHealthy>().Damage(atk); HitEffect(); } }
void Update() { target = search.SearchClosetZombie(grow.row, -range, range); if (target) { Vector3 newPos = transform.position; newPos.x = target.transform.position.x; transform.position = newPos; animator.SetTrigger("attack"); AudioManager.GetInstance().PlaySound(findZombie); StartCoroutine(DoDie()); enabled = false; } }
void Update() { transform.position = transform.position + speed * Time.deltaTime * direction; GameObject zombie = search.SearchClosetZombie(range); if (zombie) { zombie.GetComponent <ZombieHealthy>().Damage(atk); Destroy(gameObject); } if (!Camera.main.pixelRect.Contains(Camera.main.WorldToScreenPoint(transform.position))) { Destroy(gameObject); } }