void Start() { // Find handlers if designer added any scripts to the object _actionHandler = GetComponent <ActionHandler>(); if (_actionHandler != null) { _haveActionHandler = true; } _combineHandler = GetComponent <CombineHandler>(); if (_combineHandler != null) { _haveCombineHandler = true; } _dragHandler = GetComponent <DragHandler>(); if (_dragHandler != null) { _haveDragHandler = true; } _takeHandler = GetComponent <TakeToInventoryHandler>(); if (_takeHandler != null) { _haveTakeHandler = true; } _renderer = GetComponent <SpriteRenderer>(); _inventory = GameObject.FindGameObjectWithTag("Inventory").GetComponent <Inventory>(); }
public void Release() { if (_inventory != null && _inventory.IsOpen) { return; } _mouseDown = false; if (!(_startPos == transform.position)) { //if (isOverlapping) { foreach (GameObject overlappingObject in overlappingObjects) { print("overlap with " + overlappingObject.name); if (_haveCombineHandler) { _combineHandler.HandleCombination(overlappingObject); } CombineHandler otherCh = overlappingObject.GetComponent <CombineHandler>(); if (otherCh != null) { otherCh.HandleCombination(gameObject); } } overlappingObjects.Clear(); //} if (overlapsInventory) { PutIntoInventory(); } } }