//Merge action
        public override void DoAction(PlayerCharacter character, ItemSlot slot, Selectable select)
        {
            Firepit       fire      = select.GetComponent <Firepit>();
            InventoryData inventory = slot.GetInventory();

            if (fire != null && slot.GetItem() && inventory.HasItem(slot.GetItem().id))
            {
                fire.AddFuel(fire.wood_add_fuel);
                inventory.RemoveItemAt(slot.index, 1);
            }
        }
Ejemplo n.º 2
0
        public static Firepit GetNearest(Vector3 pos, float range = 999f)
        {
            float   min_dist = range;
            Firepit nearest  = null;

            foreach (Firepit fire in firepit_list)
            {
                float dist = (pos - fire.transform.position).magnitude;
                if (dist < min_dist)
                {
                    min_dist = dist;
                    nearest  = fire;
                }
            }
            return(nearest);
        }