void Update() { timer += Time.deltaTime; if (timer >= timeBetweenAttacks && playerInRange && enemyHealth.currentHealth > 0) { Attack(); } if (playerHealth.IsDead()) { anim.SetTrigger("PlayerDead"); } }
void Update() { if (playerHealth.IsDead()) { anim.SetTrigger("GameOver"); } }
void Update() { if (enemyHealth.currentHealth > 0 && !playerHealth.IsDead()) { nav.SetDestination(player.position); } else { nav.enabled = false; } }
void Spawn() { if (playerHealth.IsDead()) { return; } int spawnPointIndex = Random.Range(0, spawnPoints.Length); int enemyIndex = Random.Range(0, enemies.Length); Instantiate(enemies[enemyIndex], spawnPoints[spawnPointIndex].position, spawnPoints[spawnPointIndex].rotation); }
private void Spawn() { DespawnCurrent(); if (playerHealth.IsDead()) { return; } if (spawnPointIndex == -1) { spawnPointIndex = Random.Range(0, spawnPoints.Length); } else { spawnPointIndex = RandomExcept(0, spawnPoints.Length, spawnPointIndex); } currentLightZone = Instantiate(lightZone, spawnPoints[spawnPointIndex].position, spawnPoints[spawnPointIndex].rotation); }