Beispiel #1
0
        /// <summary>
        /// This is a WIP
        /// </summary>
        void Awake()
        {
            //If we can grab a reference to the RewardMobManager, pass it a reference of this button
            try
            {
                //grab ref of manager
                RewardMob managerRef = FindObjectOfType <RewardMob>().GetComponent <RewardMob>();

                //tell the manager that this is the button
                managerRef.rewardMobButton = this.gameObject;
                managerRef.popupBubble     = GetComponentInChildren <PopupBubble>().gameObject.transform;

                //give manager a reference to the canvas as well
                FindObjectOfType <RewardMob>().GetComponent <RewardMobAnimationManager>().canvas = this.gameObject.GetComponentInParent <Canvas>();

                managerRef.countdownTimer = GetComponentInChildren <RewardMobCountdownTimer>().gameObject;

                //hide all UI stuff
                managerRef.popupBubble.gameObject.SetActive(false);
                gameObject.SetActive(false);
            }
            catch
            {
                Debug.LogWarning("Warning! No RewardMobManager is present in the scene. RewardMob SDK calls will not work.");
            }
        }
Beispiel #2
0
 /// <summary>
 /// Initialization for Singleton logic
 /// </summary>
 private void Awake()
 {
     //if there's already a manager in the scene, delete the one you just created
     if (_instance)
     {
         DestroyImmediate(gameObject);
     }
     //otherwise make it persistent
     else
     {
         DontDestroyOnLoad(gameObject);
         _instance = this;
     }
 }