예제 #1
0
 void HeldItemChangeEvent(int delta)
 {
     selectedSlot += delta;
     if (selectedSlot < 0)
     {
         selectedSlot = HOTBAR_SIZE - 1;
     }
     if (selectedSlot >= HOTBAR_SIZE)
     {
         selectedSlot = 0;
     }
     slotEvent.Invoke(selectedSlot);
 }
예제 #2
0
 void OnTriggerExit(Collider collision)
 {
     if (collision.gameObject.CompareTag("Player") && slotType == SlotType.Occupied)
     {
         slotType = SlotType.Available;
         toggleSlotAvailiability(slotType);
         SlotEvent?.Invoke(this, new SlotEventArgs(this.GetComponent <Slot>()));
     }
 }
예제 #3
0
 void OnTriggerEnter(Collider collision)
 {
     if (collision.gameObject.CompareTag("Player"))
     {
         Debug.Log("PARKED at " + this.gameObject.name);
         slotType = SlotType.Occupied;
         toggleSlotAvailiability(slotType);
         SlotEvent?.Invoke(this, new SlotEventArgs(this.GetComponent <Slot>()));
     }
 }
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            onAttack.Invoke(Input.mousePosition);
        }
        if (Input.GetMouseButtonDown(1))
        {
            onInteract.Invoke(Input.mousePosition);
        }
        if (Input.GetMouseButtonUp(0))
        {
            releaseAttack.Invoke(Input.mousePosition);
        }
        if (Input.GetMouseButtonUp(1))
        {
            releaseInteract.Invoke(Input.mousePosition);
        }

        if (prevMousePosition != Input.mousePosition)
        {
            mouseMove.Invoke(Input.mousePosition);
        }

        float scroll = Input.mouseScrollDelta.y;

        if (scroll != 0f)
        {
            if (scroll > 0f)
            {
                onSlotChange.Invoke(-1);
            }
            else
            {
                onSlotChange.Invoke(1);
            }
        }
        prevMousePosition = Input.mousePosition;
    }
예제 #5
0
파일: Slots.cs 프로젝트: PeachTreeOath/LD41
 public void OnRelease(ObjectSlot slot, GameObject objectLeaving)
 {
     releaseEvent.Invoke(slot, objectLeaving);
 }
예제 #6
0
파일: Slots.cs 프로젝트: PeachTreeOath/LD41
 public void OnOccupy(ObjectSlot slot, GameObject objectInSlot)
 {
     occupyEvent.Invoke(slot, objectInSlot);
 }
예제 #7
0
파일: Slots.cs 프로젝트: PeachTreeOath/LD41
 public void OnClaim(ObjectSlot slot, GameObject objectEntering)
 {
     claimEvent.Invoke(slot, objectEntering);
 }