void Update()
 {
     if (!inReplay)
     {
         if (agentMovementManager.IsAllowedToMove())
         {
             Move();
         }
     }
 }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        if (playerState == PlayerState.POWERUP && agentMovementManager.IsAllowedToMove())
        {
            timer += Time.deltaTime;
            if (timer >= powerUpTime)
            {
                playerState = PlayerState.NORMAL;
                playerController.setInPowerUp(false);

                foreach (GameObject enemy in allGhosts)
                {
                    if (enemy != null)
                    {
                        enemy.GetComponent <EnemyScript>().PlayerBackToNormal();
                    }
                }

                timer = 0;
                Debug.Log("End");
            }
        }
        else if (playDead)
        {
            DeadAnimation();
        }
    }
    private void Update()
    {
        spawnTimer += Time.deltaTime;
        if (spawnTimer >= timeToSpawn)
        {
            timer += Time.deltaTime;
            if ((timer >= scatterTime && aiState != EnemyState.SEEKPLAYER) && agentMovementManager.IsAllowedToMove())
            {
                aiState = EnemyState.SEEKPLAYER;
                timer   = 0;
            }

            Tick();
        }
    }