public void IncreaseLevel() { int currentLevelIndex = levels.IndexOf(currentLevel); if (currentLevelIndex < levels.Count - 1) { CurrentLevel = levels[currentLevelIndex + 1]; } }
private bool CanUpgradeAnimal(AnimalType animalType) { switch (animalType) { case AnimalType.Ele: if (curAnimal != null) { AnimalData eleData = curAnimal.GetComponent <AnimalData>(); AnimalLevel nextLevel = eleData.GetNextLevel(); if (nextLevel != null) { return(gameManager.Food >= nextLevel.cost); } } break; case AnimalType.Gir: if (curAnimal != null) { AnimalData girData = curAnimal.GetComponent <AnimalData>(); AnimalLevel nextLevel = girData.GetNextLevel(); if (nextLevel != null) { return(gameManager.Food >= nextLevel.cost); } } break; case AnimalType.Leo: if (curAnimal != null) { AnimalData leoData = curAnimal.GetComponent <AnimalData>(); AnimalLevel nextLevel = leoData.GetNextLevel(); if (nextLevel != null) { return(gameManager.Food >= nextLevel.cost); } } break; default: return(false); } return(false); }
void OnEnable() { CurrentLevel = levels[0]; }