private void Update() { if (spawnTimer >= nextSpawnTime && !dazzaController.IsDazzaBeingRevived()) { Debug.Log("Ready to spawn something"); if (gameController.spawnList.Count > 0) { Debug.Log("they is a prefab in the game list"); if (gameController.totalLevelObjectsInPlay < gameController.totalSpawnsAllowed) { Debug.Log("there's room to spare"); if (levelObjectList.Count > 0) { Debug.Log("we have a prefab in our list"); if (gameController.spawnList[0].Equals(levelObjectList[0])) { Debug.Log("The prefab matches"); SpawnLevelPrefab(levelObjectList[0]); spawnTimer = 0f; } else { Debug.Log("prefab doesnt match"); } } else { Debug.Log("no objects queued by this generator"); } } else { Debug.Log("too many objects in the scene"); } } else { if (levelObjectList.Count < 5) { Debug.Log("Queue new prefab"); QueueLevelPrefab(); } } } else { spawnTimer += Time.deltaTime; } }
// Update is called once per frame void Update() { if (dazzaController.IsDazzaDead() == false) { if (powerUpController.GetSpeedBoostActive()) { if (powerUpController.GetHeadStartActive()) { currentDazzaAnimation = currentDazzaSkinHeadStart; if (previousDazzaAnimation != currentDazzaAnimation) { ApplyCorrectAnimation(); } previousDazzaAnimation = currentDazzaAnimation; } else { currentDazzaAnimation = currentDazzaSkinSpeedBoost; if (previousDazzaAnimation != currentDazzaAnimation) { ApplyCorrectAnimation(); } previousDazzaAnimation = currentDazzaAnimation; } } else { if (dazzaController.IsGrounded() == false) { if (dazzaController.GetJumping()) { currentDazzaAnimation = currentDazzaSkinJump; } else { currentDazzaAnimation = currentDazzaSkinFall; } } else { currentDazzaAnimation = currentDazzaSkinAnimation; } if (previousDazzaAnimation != currentDazzaAnimation) { ApplyCorrectAnimation(); } previousDazzaAnimation = currentDazzaAnimation; } } else { if (dazzaController.IsDazzaBeingRevived()) { Debug.Log("Play revive animation"); currentDazzaAnimation = currentDazzaSkinRevive; if (previousDazzaAnimation != currentDazzaAnimation) { ApplyCorrectAnimation(); } previousDazzaAnimation = currentDazzaAnimation; } else { currentDazzaAnimation = currentDazzaSkinDeath; if (previousDazzaAnimation != currentDazzaAnimation) { ApplyCorrectAnimation(); } previousDazzaAnimation = currentDazzaAnimation; } } }