Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (spawnerState == SpawnerStates.waiting)
        {
            timeBeforeSpawnStart -= Time.deltaTime;
            if (timeBeforeSpawnStart <= 0)
            {
                spawnerState = SpawnerStates.ready;
            }
        }

        if (spawnerState == SpawnerStates.ready)
        {
            m_timer -= Time.deltaTime;

            if (m_timer <= 0)
            {
                unitIndex++;

                if (unitIndex > spawnPoints.Length - 1)
                {
                    unitIndex = 0;
                }

                SpawnUnits();

                ResetSpawnTimer();
            }
        }
    }
Ejemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        // if (FindObjectOfType<GameStateManager>().isPaused == true)
        //  return;

        if (spawnerState == SpawnerStates.waiting)
        {
            timeBeforeSpawnStart -= Time.deltaTime;
            if (timeBeforeSpawnStart <= 0)
            {
                SpawnUnits();
                spawnerState = SpawnerStates.ready;
            }
        }
        else if (spawnerState == SpawnerStates.ready)
        {
            if (m_timer > 0)
            {
                m_timer -= Time.deltaTime;
            }
            else
            {
                SpawnUnits();
                ResetSpawnTimer();
            }
        }
    }
Ejemplo n.º 3
0
    public void StopSpawnCicle()
    {
        ActualState = SpawnerStates.WAITING;
        animatorController.SetBool("IsSpawning", false);

        if (spawnCicle != null)
        {
            StopCoroutine(spawnCicle);
        }
        spawnCicle = null;
    }
    // Essa função apenas spawnad e seta o statos do spawner de acordo com o limimte
    // Ela não controla os turnos
    public IEnumerator SpawnCicle()
    {
        // Se o spawner atinge seu limite ele para
        if (countSpawnedEnemys >= spawnLimit || actualState == SpawnerStates.WAITING)
        {
            actualState = SpawnerStates.WAITING;

            Debug.Log("Limite spawn atingido estado de espera");

            yield break;
        }

        for (int i = 0; i < spawnLimit; i++)
        {
            SpawnEnemy();

            // Faz a cazerna esperar para spawnar o próximo
            yield return(new WaitForSeconds(spawnFrequency));
        }

        yield break;
    }
Ejemplo n.º 5
0
 public void StartSpawnCicle()
 {
     ActualState = SpawnerStates.SPAWNING;
     animatorController.SetBool("IsSpawning", true);
     spawnCicle = StartCoroutine(SpawnCicle());
 }
Ejemplo n.º 6
0
 void Start()
 {
     spawnerState = SpawnerStates.waiting;
     m_timer      = timeBetweenSpawns;
     spawnPoints  = GetComponentsInChildren <HangerSpawner>();
 }
Ejemplo n.º 7
0
 void Start()
 {
     spawnerState = SpawnerStates.waiting;
     m_timer      = timeBetweenSpawns;
     spawnPoints  = FindObjectsOfType <HangerSpawner>();
 }