void FixedUpdate() { if(currentActivity == TrainingActivity.LevelUp && heroTraining != null) { if(progress < 5000) { progress ++; }else if(progress >= 5000) { heroTraining.LevelUp(); progress = 0; currentActivity = TrainingActivity.None; } }else if(currentActivity == TrainingActivity.NewHero) { if(progress < 10000) { progress ++; }else if(progress >= 10000) { progress = 0; GameObject newHero = Instantiate(newHeroPrefab); newHero.transform.position = new Vector3(transform.position.x, transform.position.y, -1); Camera.main.gameObject.GetComponent<Army>().heroes.Add(newHero); currentActivity = TrainingActivity.None; } } }
public void newHero() { currentActivity = TrainingActivity.NewHero; }