private void Start() { playerSword.OnEnemyKilled += PlayerSword_OnEnemyKilled; levelSystemAnimated.OnExperienceChanged += LevelSystemAnimated_OnExperienceChanged; levelSystemAnimated.OnLevelChanged += LevelSystemAnimated_OnLevelChanged; levelText.SetText((levelSystemAnimated.GetLevelNumber() + 1).ToString()); }
private void LevelSystem_OnLevelChanged(object sender, EventArgs e) { // For this private variable, the point is to activate different variables as the level changes // PlayVictoryAnim(); // One of the important variables, is playing a Victory animation through PlayVictoryAnim() once the level changes // SpawnParticleEffect(); // Another variable is for the particle effect to initiate after the change in levels // Flash(new Color(1, 1, 1, 1)); // With every particle effect, there comes a series of colors (1, 1, 1, 1) that must be initiated // SetHealthBarSize(1f + levelSystemAnimated.GetLevelNumber() * .1f); // The healthbar, especially it's size, is an important component of every game. // } // In this situation, you are setting the HealthBarSize to increase by 1f (1 level point) once there is a update in the level, which is done through levelSystemAnimated.GetLevelNumber)
private void LevelSystem_OnLevelChanged(object sender, EventArgs e) { PlayVictoryAnim(); SpawnParticleEffect(); Flash(new Color(1, 1, 1, 1)); SetHealthBarSize(1f + levelSystemAnimated.GetLevelNumber() * .1f); }
public void SetLevelSystemAnimated(LevelSystemAnimated levelSystemAnimated) { // Set the LevelSystemAnimated object this.levelSystemAnimated = levelSystemAnimated; // Update the starting values SetLevelNumber(levelSystemAnimated.GetLevelNumber()); SetExperienceBarSize(levelSystemAnimated.GetExperienceNormalized()); // Surbscribe to the changed events levelSystemAnimated.OnExperienceChanged += LevelSystemAnimated_OnExperienceChanged; levelSystemAnimated.OnLevelChanged += LevelSystemAnimated_OnLevelChanged; }
private void LevelSystemAnimated_OnLevelChanged(object sender, System.EventArgs e) { // Level changed, update text SetLevelNumber(levelSystemAnimated.GetLevelNumber()); }