예제 #1
0
    void OnEnable()
    {
        m_InitTime = Time.time;
        if (m_DisplayMessageManager == null)
        {
            m_DisplayMessageManager = FindObjectOfType <DisplayMessageManager>();
        }

        DebugUtility.HandleErrorIfNullFindObject <DisplayMessageManager, DisplayMessage>(m_DisplayMessageManager, this);
    }
예제 #2
0
    // Update is called once per frame
    void Update()
    {
        if (!m_DisplayMessageManager)
        {
            m_DisplayMessageManager = FindObjectOfType <DisplayMessageManager>();
            DebugUtility.HandleErrorIfNullFindObject <DisplayMessageManager, DisplayMessage>(m_DisplayMessageManager, this);
        }
        if (m_WasDisplayed)
        {
            return;
        }

        if (Time.time - m_InitTime > delayBeforeShowing)
        {
            var messageInstance = Instantiate(messagePrefab, m_DisplayMessageManager.DisplayMessageRect);
            var notification    = messageInstance.GetComponent <NotificationToast>();
            if (notification)
            {
                notification.Initialize(message);
            }

            m_WasDisplayed = true;
        }
    }
예제 #3
0
 void Start()
 {
     m_InitTime = Time.time;
     m_DisplayMessageManager = FindObjectOfType <DisplayMessageManager>();
     DebugUtility.HandleErrorIfNullFindObject <DisplayMessageManager, DisplayMessage>(m_DisplayMessageManager, this);
 }