예제 #1
0
    protected override void AfterOnStartLocalPlayer()
    {
        /* Get the toolbelt manager from the player */
        toolbeltManager = GetComponent <PlayerToolbeltManager>();
        if (toolbeltManager == null)
        {
            throw new System.Exception("Why does this VR player not have a toolbelt!");
        }

        /* Get the inventory manager for this player */
        playerInventory = GetComponent <PlayerInventoryManager>();
        if (playerInventory == null)
        {
            throw new System.Exception("Why is there no player inventory manager for this player?");
        }

        /* Get the bank manager for this player */
        playerBank = GetComponent <PlayerBankManager>();
        if (playerBank == null)
        {
            throw new System.Exception("Why is there no player bank manager for this player?");
        }

        /* Get the relic menu object */
        RelicUIManager relicUI = inventoryMenuObj.GetComponent <RelicUIManager>();

        Debug.Assert(relicUI != null);
        relicUI.SetPlayerInventory(playerInventory.GetInventory());

        /* Get the bank menu object */
        BankUIManager bankUI = bankMenuObj.GetComponent <BankUIManager>();

        Debug.Assert(bankUI != null);
        bankUI.SetPlayerBankManager(playerBank);
    }
예제 #2
0
    /**
     * Called by the player relic when the relic finishes openening.
     */
    public void RelicOpened(PlayerRelic.RelicConfiguration config)
    {
        if (!isLocalPlayer)
        {
            return;
        }

        /* Update the player's menu */
        RelicUIManager playerUI = inventoryMenuObj.GetComponent <RelicUIManager>();

        Debug.Assert(playerUI != null);
        playerUI.SetPlayerInventory(playerInventory.GetInventory());
        playerUI.InventoryUpdated();

        /* Update the player's bank menu */
        BankUIManager bankUI = bankMenuObj.GetComponent <BankUIManager>();

        Debug.Assert(bankUI != null);
        bankUI.SetPlayerBankManager(playerBank);
        bankUI.BankUpdated();

        switch (config)
        {
        case PlayerRelic.RelicConfiguration.OpenInventory:
            /* Reposition the player inventory */
            inventoryMenuObj.transform.parent        = relic.gameObject.transform;
            inventoryMenuObj.transform.localPosition = Vector3.zero;
            inventoryMenuObj.transform.localRotation = Quaternion.identity;

            /* Show the inventory menu */
            ShowMenu(inventory_menu_name);
            break;

        case PlayerRelic.RelicConfiguration.OpenBank:
            /* Reposition the player inventory */
            inventoryMenuObj.transform.parent        = relic.bankUIRelicPosition.transform;
            inventoryMenuObj.transform.localPosition = Vector3.zero;
            inventoryMenuObj.transform.localRotation = Quaternion.identity;

            /* Reposition the bank inventory */
            bankMenuObj.transform.parent        = relic.bankUIPosition.transform;
            bankMenuObj.transform.localPosition = Vector3.zero;
            bankMenuObj.transform.localRotation = Quaternion.identity;

            /* Show menues */
            ShowMenu(inventory_menu_name);
            ShowMenu(bank_menu_name);
            break;
        }
    }