예제 #1
0
 public void Emit(RocketSlot slot, SlotEvent type)
 {
     if (OnRocketSlotAction != null)
     {
         OnRocketSlotAction(slot, type);
     }
 }
예제 #2
0
 public void Activate(SlotEvent slotEvent)
 {
     assets.tweens.tsBonus.Play();
     assets.audioBonus.Play();
     this.slotEvent = slotEvent;
     gameObject.SetActive(true);
     bonusSlot.Activate();
 }
예제 #3
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>()));
     }
 }
예제 #4
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>()));
     }
 }
예제 #5
0
    private void Workshop_OnRocketSlotAction(RocketSlot slot, SlotEvent type)
    {
        if (type == SlotEvent.Activated)
        {
            Start();
        }

        if (type == SlotEvent.Empied || type == SlotEvent.Filled)
        {
            workshop.Emit(Ready ? RocketEventsTypes.Ready : RocketEventsTypes.Incomplete);
        }
    }
예제 #6
0
 private void Workshop_OnRocketSlotAction(RocketSlot slot, SlotEvent type)
 {
     if (state == StoreItemEvents.Drag)
     {
         if (type == SlotEvent.Hover)
         {
             if (slot.itemType == itemType)
             {
                 this.slot = slot;
             }
         }
         else if (type == SlotEvent.Exit && slot == this.slot)
         {
             this.slot = null;
         }
     }
 }
예제 #7
0
        public Player(string name, Vector2 pos) : base(name)
        {
            slotEvent    = new SlotEvent();
            selectedSlot = 0;
            GameObject prefab = Resources.Load("Prefabs/" + name) as GameObject;

            inventory = new Inventory(INVENTORY_SIZE + HOTBAR_SIZE, 4, "Inventory");
            inventory.AddItem(new ItemStack(ItemData.PICKAXE, 1));
            inventory.AddItem(new ItemStack(ItemData.SHOVEL, 1));
            inventory.AddItem(new ItemStack(ItemData.WOOD, 75));
            inventory.AddItem(new ItemStack(ItemData.WORKBENCH, 10));
            entityObject = PlayerController.Instantiate(prefab, pos, Quaternion.identity);
            controller   = entityObject.GetComponent <PlayerController>();

            controller.AddSlotListener(HeldItemChangeEvent);
            controller.AddOnAttackListener(OnAttack);
            controller.AddOnInteractListener(OnInteract);
            controller.AddReleaseAttackListener(ReleaseAttack);
            controller.AddReleaseInteractListener(ReleaseInteract);
            controller.AddMouseMoveEvent(MouseChangePosition);
        }