Exemple #1
0
        public override void initialize()
        {
            if (!initialized)
            {
                initialized = true;

                myHUDData = new FPEHUDData();

                reticle         = transform.Find("Reticle").GetComponent <RectTransform>();
                interactionIcon = transform.Find("InteractionIcon").GetComponent <RectTransform>();

                journalBackground     = transform.Find("JournalBackground").gameObject;
                journalCloseIndicator = transform.Find("JournalBackground/CloseIndicator").gameObject;
                journalPreviousButton = transform.Find("JournalBackground/PreviousButton").gameObject;
                journalNextButton     = transform.Find("JournalBackground/NextButton").gameObject;
                journalPage           = transform.Find("JournalBackground/JournalPage").gameObject;

                audioDiaryIcon   = transform.Find("AudioDiaryIcon").GetComponent <RectTransform>();
                notificationIcon = transform.Find("NotificationIcon").GetComponent <RectTransform>();

                if (!reticle || !interactionIcon || !audioDiaryIcon || !notificationIcon || !journalCloseIndicator || !journalPreviousButton || !journalNextButton || !journalBackground || !journalPage)
                {
                    Debug.LogError("FPEInteractionManagerScript:: UI and/or Journal Components are missing. Did you change the FPEInteractionManager prefab?");
                }

                notificationIconLargestScale  = new Vector3(1.1f, 1.1f, 1.1f);
                notificationIconSmallestScale = new Vector3(0.9f, 0.9f, 0.9f);

                StopPlayingAudioDiary();
            }
        }
        public override void initialize()
        {
            if (!initialized)
            {
                initialized = true;

                myHUDData = new FPEHUDData();

                reticle          = transform.Find("Reticle").GetComponent <RectTransform>();
                interactionLabel = transform.Find("InteractionTextLabel").GetComponent <RectTransform>();

                if (!HUDEnabled && (reticleEnabled || interactionTextEnabled || controlHintUIEnabled || audioDiaryUIEnabled || notificationUIEnabled))
                {
                    Debug.LogWarning("FPEDefaultHUD:: HUD is disabled, but one or more other UI sections is enabled. HUD setting will disable all HUD elements regardless of individual setting.");
                }

                journalBackground       = transform.Find("JournalBackground").gameObject;
                journalCloseIndicator   = transform.Find("JournalBackground/CloseIndicator").gameObject;
                journalPreviousButton   = transform.Find("JournalBackground/PreviousButton").gameObject;
                journalNextButton       = transform.Find("JournalBackground/NextButton").gameObject;
                journalPage             = transform.Find("JournalBackground/JournalPage").gameObject;
                audioDiaryLabel         = transform.Find("AudioDiaryTitleLabel").GetComponent <RectTransform>();
                audioDiarySkipHintLabel = transform.Find("AudioDiarySkipHintLabel").GetComponent <RectTransform>();
                notificationLabel       = transform.Find("NotificationLabel").GetComponent <RectTransform>();
                zoomExamineHint         = transform.Find("ZoomExamineHint").GetComponent <FPEUIHint>();
                interactHint            = transform.Find("InteractHint").GetComponent <FPEUIHint>();
                inventoryHint           = transform.Find("InventoryHint").GetComponent <FPEUIHint>();
                unDockHint = transform.Find("UndockHint").GetComponent <FPEUIHint>();

                // UI component error checks
                if (!zoomExamineHint || !interactHint || !inventoryHint || !unDockHint)
                {
                    Debug.LogError("FPEDefaultHUD:: UI Hints are missing. Did you change the FPEInteractionManager prefab?");
                }

                // Just in case they were disabled during an edit to the prefab
                zoomExamineHint.gameObject.SetActive(true);
                interactHint.gameObject.SetActive(true);
                inventoryHint.gameObject.SetActive(true);
                unDockHint.gameObject.SetActive(true);

                // The undock hint is sort of special, as we don't necessarily set it like the others. So disable it here to start.
                unDockHint.setHint("");

                if (!reticle || !interactionLabel || !audioDiaryLabel || !audioDiarySkipHintLabel || !notificationLabel || !journalCloseIndicator || !journalPreviousButton || !journalNextButton || !journalBackground || !journalPage)
                {
                    Debug.LogError("FPEDefaultHUD:: UI and/or Journal Components are missing. Did you change the FPEInteractionManager prefab?");
                }

                if (!reticleEnabled)
                {
                    reticle.GetComponentInChildren <Image>().enabled = false;
                }

                if (!interactionTextEnabled)
                {
                    interactionLabel.GetComponentInChildren <Text>().enabled = false;
                }

                interactionLabelLargestScale  = new Vector3(1.0f, 1.0f, 1.0f);
                interactionLabelSmallestScale = new Vector3(0.0f, 0.0f, 0.0f);

                audioDiaryLabelLargestScale  = new Vector3(1.1f, 1.1f, 1.1f);
                audioDiaryLabelSmallestScale = new Vector3(0.9f, 0.9f, 0.9f);

                defaultDiaryColor = audioDiaryLabel.GetComponent <Text>().color;
                diaryFadeColor    = audioDiaryLabel.GetComponent <Text>().color;
                diaryFadeColor.a  = 0.0f;

                notificationLabelLargestScale  = new Vector3(1.1f, 1.1f, 1.1f);
                notificationLabelSmallestScale = new Vector3(0.9f, 0.9f, 0.9f);

                defaultNotificationColor = notificationLabel.GetComponent <Text>().color;
                notificationFadeColor    = notificationLabel.GetComponent <Text>().color;
                notificationFadeColor.a  = 0.0f;

                setMouseHints("", "", "");
                StopPlayingAudioDiary();
            }
        }
 protected virtual void Update()
 {
     myHUDData = FPEInteractionManagerScript.Instance.GetHUDData();
     updateHUD();
 }