//Initialization void Awake() { //Transition gm = GameManager.instance; transition = GetComponent <InventoryTransition>(); createMenu(); //Inventory Slots slots = new InventorySlotScript[6]; int i = 0; for (int h = 0; h < 3; h++) { for (int w = 0; w < 2; w++) { slots[i] = Instantiate(Resources.Load <GameObject>("System/GUI/inventory_slot")).GetComponent <InventorySlotScript>(); slots[i].transform.SetParent(transform); slots[i].transform.localPosition = new Vector3(314 + (w * 224), 176 + (h * -172), 0); slots[i].transform.localScale = new Vector3(2.9f, 2.9f, 1); i++; } } //Equip Slot equip_slot = Instantiate(Resources.Load <GameObject>("System/GUI/inventory_slot")).GetComponent <InventorySlotScript>(); equip_slot.transform.SetParent(transform); equip_slot.transform.localPosition = new Vector3(55, -190); equip_slot.transform.localScale = new Vector3(2.9f, 2.9f, 1); //Select Cursor select_cursor = new Image[4]; for (i = 0; i < 4; i++) { GameObject cursor_obj = new GameObject("cursor_corner" + i, typeof(RectTransform), typeof(Image)); cursor_obj.transform.SetParent(transform); cursor_obj.GetComponent <RectTransform>().sizeDelta = new Vector2(10, 10); cursor_obj.transform.localPosition = new Vector3(0, 0, 0); cursor_obj.transform.localScale = new Vector3(3, 3, 1); select_cursor[i] = cursor_obj.GetComponent <Image>(); select_cursor[i].sprite = Resources.Load <Sprite>("System/GUI/Cursor/sInventorySelect" + (i + 1)); } //Settings can_move = true; offset = 15f; text_spd = 12f; //Variables picked = false; sin_val = 0f; select = 0; draw_ui_text = false; ui_text_timer = 0; ui_text = ""; select_menu_index = -1; resetHealthValues(); }
private void Awake() { _background = GetComponent <Image>(); _commonField = GetComponentInParent <InventoryMainScript>().gameObject; _canvasGroup = GetComponent <CanvasGroup>(); EquipSlot = GetComponentInParent <InventorySlotScript>(); }
// Start is called before the first frame update void Start() { gManager = GameManager.instance; suiScript = transform.root.GetComponent <ShopUIScript>(); dpScript = GameObject.Find("DummyPlayer").GetComponent <DummyPlayerScript>(); isScript = gameObject.GetComponentInParent <InventorySlotScript>(); mechaPart = isScript.mechaPart; Debug.Log("The Equip Button can see that it is a button on an inventory slot representing..." + mechaPart.name); }
//Called by inventory buttons public void InventoryEquip(Weapon w, InventorySlotScript iss) { //Return currently equipped weapon to the inventory. //Can be a null value. iss.StoreItem(playerCoreScript.weapon); //Equip weapon in the player playerCoreScript.EquipWeapon(w); UpdateStatsUI(); }
public void SetSlotNumber(InventorySlotScript linkedSlot) { _linkedSlot = linkedSlot; }