コード例 #1
0
 void OnEnable()
 {
     Data?.UpdateItems(this);
     OnItemFocused.AddListener(UpdateSelectedItem);
     if (UI)
     {
         OnItemFocused.AddListener(UI.UpdateSelectedItemUI);
     }
     Controller?.UpdateLockItems();
 }
コード例 #2
0
        //──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
        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.
            }
        }
コード例 #3
0
ファイル: SelectorManager.cs プロジェクト: dqtoy/Chess
        //──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
        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.
            }
        }