private void Awake() { LevelSystem levelSystem = new LevelSystem(); LevelSystemAnimated levelSystemAnimated = new LevelSystemAnimated(levelSystem); player.SetLevelSystemAnimated(levelSystemAnimated); }
private void Awake() { playerSword = GetComponent <PlayerSword>(); levelSystem = new LevelSystem(); levelSystemAnimated = new LevelSystemAnimated(levelSystem); playerSkills = new PlayerSkills(); playerSkills.OnSkillUnlocked += PlayerSkills_OnSkillUnlocked; }
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; }
[SerializeField] private EquipWindow equipWindow; // You are setting the private integer to equip the window // // [SerializeField] Serialization is the automatic process of transforming data structures or object states into a format that Unity can store and reconstruct later. // // Some of Unity’s built-in features use serialization; features such as saving and loading, the Inspector, window, instantiation and Prefabs // private void Awake() // Awake is called when the script instance is being loaded. // { LevelSystem levelSystem = new LevelSystem(); // Awake is called either when an active GameObject that contains the script is initialized when a Scene loads, // // or when a previously inactive GameObject is set to active, or after a GameObject created with Object.Instantiate is initialized. // // Use Awake to initialize variables or states before the application starts. // levelWindow.SetLevelSystem(levelSystem); // You are using levelWindow to set the levelSystem // equipWindow.SetLevelSystem(levelSystem); // You are using equipWindow to set the levelSystem // LevelSystemAnimated levelSystemAnimated = new LevelSystemAnimated(levelSystem); // In all code, repeating the same variable twice establishes what you're trying to do // // That's why it's always necessary to do LevelSystemAnimted levelSystemAnimated // levelWindow.SetLevelSystemAnimated(levelSystemAnimated); // In this code, you are using the levelWindow to set the animated level system // player.SetLevelSystemAnimated(levelSystemAnimated); // In this code, you are using the player to trigger the animated level system, as the player is an integer connected to the level system // }
public void SetLevelSystemAnimated(LevelSystemAnimated levelSystemAnimated) { // Any animated variable must be a public variable to make it show during the game // this.levelSystemAnimaed = levelSystemAnimated; // This code is used to confirm the levelSystemAnimated variable // levelSystemAnimated.OnLevelChanged += LevelSystem_OnLevelChanged; // This piece of code is meant to establish that the animation and the change in the game level is correlated // }
public void SetLevelSystemAnimated(LevelSystemAnimated levelSystemAnimated) { this.levelSystemAnimated = levelSystemAnimated; levelSystemAnimated.OnLevelChanged += LevelSystem_OnLevelChanged; }