Ejemplo n.º 1
0
    private void Start()
    {
        inventory = FindObjectOfType <Inventory>();

        mainSlot = FindObjectOfType <MainSlot>();

        textNumberOfItems.gameObject.SetActive(false);
    }
Ejemplo n.º 2
0
 public void OnPointerClick(PointerEventData eventData)
 {
     if (eventData.button == PointerEventData.InputButton.Left)
     {
         SelectSlot = this;
         EventManager.Instance.PostNotification(EventType.MainSlotChange, this, SelectSlot);
         Debug.Log("메인슬롯 바꿈 알림");
     }
 }
Ejemplo n.º 3
0
    void Awake()
    {
        MainSlots.Add(this);
        if (SelectSlot == null)
        {
            SelectSlot = this;
        }

        EventManager.Instance.AddListener(EventType.MainSlotChange, this);
        EventManager.Instance.AddListener(EventType.GetItem, this);
    }
Ejemplo n.º 4
0
    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();
        }
    }
Ejemplo n.º 5
0
    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++;
        }
    }