Пример #1
0
 void Start()
 {
     playerGameObject     = GameObject.FindGameObjectWithTag("Player");
     playerMovementScript = playerGameObject.GetComponent <PlayerMovement>();
     canvas         = GameObject.FindGameObjectWithTag("Canvas");
     craftingObject = canvas.transform.Find("UI_Crafting").gameObject;
     crafting       = craftingObject.GetComponent <UI_Crafting>();
 }
Пример #2
0
    protected override void Awake()
    {
        base.Awake();

        if (Enable)
        {
            CraftingWindowComponent = GetComponentInParent <UI_Crafting> ();
            if (!CraftingWindowComponent)
            {
                Debug.LogError("UI_Crategory: Crafting window component is null");
            }
        }
    }
Пример #3
0
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            bool isActiveUI = false;
            foreach (GameObject ui in togglableUIs)
            {
                UI_TogglableInventory inventory = ui.GetComponent <UI_TogglableInventory>();
                UI_Crafting           crafting  = ui.GetComponent <UI_Crafting>();

                if (inventory != null && inventory.isActive)
                {
                    isActiveUI = true;
                    break;
                }
                else if (crafting != null && crafting.isActive)
                {
                    isActiveUI = true;
                    break;
                }
            }

            if (isActiveUI)
            {
                foreach (GameObject ui in togglableUIs)
                {
                    UI_TogglableInventory inventory = ui.GetComponent <UI_TogglableInventory>();
                    UI_Crafting           crafting  = ui.GetComponent <UI_Crafting>();

                    if (inventory != null && inventory.isActive)
                    {
                        inventory.Toggle();
                    }
                    else if (crafting != null && crafting.isActive)
                    {
                        crafting.Toggle();
                    }
                }
            }
            else
            {
                pauseMenu.Toggle();
            }
        }
    }
Пример #4
0
 void Awake()
 {
     craft = GameObject.Find("Ultimate Inventory Pro").GetComponent <UI_Crafting>(); //assign inv GO at once
 }
Пример #5
0
 private void Awake()
 {
     rectTransform = GetComponent <RectTransform>();
     uI_Crafting   = FindObjectOfType <UI_Crafting>();
 }
Пример #6
0
 void Awake()
 {
     //assign crafting and itemslist scripts
     craft = inv.GetComponent <UI_Crafting>();
     items = inv.GetComponent <UI_ItemsList>();
 }