Example #1
0
    // Use this for initialization
    void Awake()
    {
        #region Singleton Behaviour
        /* Singleton behaviour. */
        if (_instance == null)
        {
            _instance = this;
        }
        else if (_instance != this)
        {
            Destroy(gameObject);
            Destroy(this);
            return;
        }
        DontDestroyOnLoad(gameObject);
        #endregion

        hotSpot = new Vector2(cursorTexture.width / 2, cursorTexture.height / 2);   // middle of the crossheir

        inventoryUIOn = false;
        dialogueUIOn  = false;
        insigniaOn    = false;
        journalOn     = false;
        healthBarOn   = true;
        expBarOn      = true;

        playerController = player.GetComponent <PlayerController>();
        playerInventory  = inventory.GetComponent <PlayerInventory>();
        questTracker     = questTrackerObj.GetComponent <UIQuestTracker>();
        dialogue         = dialogueObj.GetComponent <DialogueManager>();
        insigniaPanel    = insigniaObj.GetComponent <InsigniaPanel>();
        healthBar        = healthBarObj.GetComponent <HealthBar>();
        journal          = journalObj.GetComponent <Journal>();
        expBar           = expBarObj.GetComponent <EXPBar>();
        itemTooltip      = itemTooltipObj.GetComponent <ItemTooltip>();
        playerHp         = playerController.Hp;

        /* Turn on (initialize) the UI, then turn it back off (assumes they're hidden in Unity editor at start). */
        inventory.SetActive(true);
        inventory.SetActive(false);
        dialogueObj.SetActive(true);
        dialogueObj.SetActive(false);
        insigniaObj.SetActive(true);
        insigniaObj.SetActive(false);
        journalObj.SetActive(true);
        journalObj.SetActive(false);
        itemTooltipObj.SetActive(true);
        itemTooltipObj.SetActive(false);
    }
Example #2
0
    // Use this for initialization
    void Awake()
    {
        #region Singleton Behaviour
        /* Singleton behaviour. */
        if (_instance == null)
        {
            _instance = this;
        }
        else if (_instance != this)
        {
            Destroy(this);
            return;
        }
        //DontDestroyOnLoad(gameObject); already in UI
        #endregion

        questBlockGOs = new List <GameObject>();
        blockHeights  = new List <float>();
    }