void OnEnable() { Data?.UpdateItems(this); OnItemFocused.AddListener(UpdateSelectedItem); if (UI) { OnItemFocused.AddListener(UI.UpdateSelectedItemUI); } Controller?.UpdateLockItems(); }
//────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── void Awake() { // Find the player player = GameObject.FindWithTag("Player"); if (Controller || Editor || UI) { } //Store all the Selector Components on variables if (Data) { Data.LoadDataPlayerPref(); //Checks if you're using PlayerPref and load the Data from there Data.UpdateItems(this); //If you are using Data Update it // Update the data coins Data.Save.Coins = Game_Controller.COINS; } LastTarget.StoreTransform(Target); //Store the Transform of the Target to Animate. if (!EnableSelector) { if (Controller) { Controller.gameObject.SetActive(false); } if (UI) { UI.gameObject.SetActive(false); } } if (Controller.CurrentItem) { UpdateSelectedItem(Controller.CurrentItem.gameObject); //Update the Focused item on the Manager } if (ItemSelected) { UI.UpdateSelectedItemUI(ItemSelected.gameObject); //Updates the UI. } }
//────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── void Awake() { if (Controller || Editor || UI) { } //Store all the Selector Components on variables if (DontDestroy) { DontDestroyOnLoad(transform.root.gameObject); } if (Data) { Data.LoadDataPlayerPref(); //Checks if you're using PlayerPref and load the Data from there Data.UpdateItems(this); //If you are using Data Update it } LastTarget.StoreTransform(Target); //Store the Transform of the Target to Animate. if (!EnableSelector) { if (Controller) { Controller.gameObject.SetActive(false); } if (UI) { UI.gameObject.SetActive(false); } } if (Controller.CurrentItem) { UpdateSelectedItem(Controller.CurrentItem.gameObject); //Update the Focused item on the Manager } if (ItemSelected) { UI.UpdateSelectedItemUI(ItemSelected.gameObject); //Updates the UI. } }