private void Start() { inventory = FindObjectOfType <Inventory>(); mainSlot = FindObjectOfType <MainSlot>(); textNumberOfItems.gameObject.SetActive(false); }
public void OnPointerClick(PointerEventData eventData) { if (eventData.button == PointerEventData.InputButton.Left) { SelectSlot = this; EventManager.Instance.PostNotification(EventType.MainSlotChange, this, SelectSlot); Debug.Log("메인슬롯 바꿈 알림"); } }
void Awake() { MainSlots.Add(this); if (SelectSlot == null) { SelectSlot = this; } EventManager.Instance.AddListener(EventType.MainSlotChange, this); EventManager.Instance.AddListener(EventType.GetItem, this); }
void ChangeSlot(int id) { MainSlot selectedSlot = FindObjectsOfType <MainSlot>().Where(x => x.ID == id).FirstOrDefault(); if (selectedSlot != null) { selectedSlotInstance.gameObject.transform.SetParent(selectedSlot.transform); selectedSlotInstance.gameObject.transform.SetAsFirstSibling(); selectedSlotInstance.GetComponent <RectTransform>().anchoredPosition = Vector2.zero; placeObject.objectToPlacePrefab = selectedSlot.currentObject; Utils.DestroySubSlots(); } }
void Initiate() { int counter = 0; foreach (MyObjectToPlace obj in myObjects) { if (!allyTypes.Contains(obj.allyType)) { allyTypes.Add(obj.allyType); } } foreach (AllyType allyType in allyTypes) { MainSlot instance = Instantiate(mainSlotPrefab, content); instance.SetObjects(myObjects.Where(x => x.allyType.Equals(allyType)).ToList()); instance.SetParameters(counter); counter++; } }