Пример #1
0
    void OnTriggerStay(Collider other)
    {
        if (other.tag == "Player")
        {
            if (Input.GetKeyDown(keyToUse) && allowChangeScene)
            {
                HudText.EraseText();

                this.transform.localScale = inventoryScale;

                this.GetComponent <Collider>().isTrigger = false;
                BoxCollider col = this.GetComponent <Collider>() as BoxCollider;
                col.size   = inventoryColliderSize;
                col.center = inventoryColliderPosition;


                this.transform.parent = inventory.gameObject.transform;
                DontDestroyOnLoad(this.gameObject);

                if (!isSolid)
                {
                    inventory.AddReagentLiquid(reagent);
                    reagent.inInventory = true;
                }
                else
                {
                    inventory.AddReagentSolid(reagentSolid);
                }
            }
        }
    }
Пример #2
0
    // Update is called once per frame

    /*void Update () {
     *
     * }*/

    //! Add selected itensType in inventory (glassware, reagent liquid and reagent solid).
    public void ButtonPressed(int index)
    {
        switch (itensType)
        {
        case ItemType.GLASSWARE:
        {
            GameObject item = Instantiate(objectPrefabs[index]) as GameObject;
            inventory.AddGlassware(item.GetComponent <Glassware>());
            item.transform.parent = inventory.transform;
        }
        break;

        case ItemType.REAGENT_LIQUID:
        {
            GameObject item = Instantiate(objectPrefabs[index]) as GameObject;
            inventory.AddReagentLiquid(item.GetComponent <ReagentsLiquid>());
            item.transform.parent = inventory.transform;
        }
        break;

        case ItemType.REAGENT_SOLID:
        {
            GameObject item = Instantiate(objectPrefabs[index]) as GameObject;
            inventory.AddReagentSolid(item.GetComponent <ReagentsSolid>());
            item.transform.parent = inventory.transform;
        }
        break;
        }
    }