Beispiel #1
0
 void HeldItemChangeEvent(int delta)
 {
     selectedSlot += delta;
     if (selectedSlot < 0)
     {
         selectedSlot = HOTBAR_SIZE - 1;
     }
     if (selectedSlot >= HOTBAR_SIZE)
     {
         selectedSlot = 0;
     }
     slotEvent.Invoke(selectedSlot);
 }
Beispiel #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>()));
     }
 }
Beispiel #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;
    }
Beispiel #5
0
 public void OnRelease(ObjectSlot slot, GameObject objectLeaving)
 {
     releaseEvent.Invoke(slot, objectLeaving);
 }
Beispiel #6
0
 public void OnOccupy(ObjectSlot slot, GameObject objectInSlot)
 {
     occupyEvent.Invoke(slot, objectInSlot);
 }
Beispiel #7
0
 public void OnClaim(ObjectSlot slot, GameObject objectEntering)
 {
     claimEvent.Invoke(slot, objectEntering);
 }