public DragPreview Create(Transform parent, InventoryObject obj)//, Vector3 position) { DragPreview dp = Instantiate(gameObject, parent).GetComponent <DragPreview>(); dp._image.sprite = obj.Icon; //dp._image.SetNativeSize(); return(dp); }
public void OnObjectBeginDrag(Slot slot, InventoryObject obj) { if (_context.DraggedObject == null) { return; } _context.DraggedObject.gameObject.SetActive(false); }
public virtual bool Store(InventoryObject obj) { Color = obj.Color; _object = obj; _object.OnMovedHandler += OnObjectMoved; _object.transform.SetParent(transform); _object.transform.localPosition = Vector3.zero; _object.transform.localScale = new Vector3(1, 1, 1); return(true); }
public bool TrySwap(Slot otherSlot) { if (IsEmpty && !otherSlot.IsEmpty) { Store(otherSlot._object); return(true); } else if (otherSlot.IsEmpty && !IsEmpty) { otherSlot.Store(_object); return(true); } else if (!otherSlot.IsEmpty && !otherSlot.IsEmpty) { InventoryObject tmp = _object; Store(otherSlot._object); otherSlot.Store(tmp); return(true); } return(false); }
public override bool Store(InventoryObject obj) { obj.Reference.gameObject.SetActive(true); base.Store(obj.Reference); return(true); }
public void OnInventoryObjectDragEnd(Slot slot) { _draggedObject = null; _draggedSlot = null; }
public void OnObjectBeginDrag(Slot slot, InventoryObject obj) { _draggedSlot = slot; _draggedObject = obj; }
public override void OnObjectMoved(InventoryObject obj) { //_object.OnMovedHandler -= OnObjectMoved; //_object = null; }
private void OnObjectUsed(Slot slot, InventoryObject obj) { obj.TryUse(_context.Character); // If empty remove object }
public void OnObjectBeginDrag(Slot slot, InventoryObject obj) { //_context.DraggedObject.gameObject.SetActive(false); }
public virtual void OnObjectMoved(InventoryObject obj) { Color = _defaultColor; _object.OnMovedHandler -= OnObjectMoved; _object = null; }