コード例 #1
0
    void Update()
    {
        timer += Time.deltaTime;

        if (timer >= timeBetweenAttacks && playerInRange && enemyHealth.currentHealth > 0)
        {
            Attack();
        }

        if (playerHealth.IsDead())
        {
            anim.SetTrigger("PlayerDead");
        }
    }
コード例 #2
0
 void Update()
 {
     if (playerHealth.IsDead())
     {
         anim.SetTrigger("GameOver");
     }
 }
コード例 #3
0
 void Update()
 {
     if (enemyHealth.currentHealth > 0 && !playerHealth.IsDead())
     {
         nav.SetDestination(player.position);
     }
     else
     {
         nav.enabled = false;
     }
 }
コード例 #4
0
    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);
    }
コード例 #5
0
    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);
    }