/** * Check budget availabilities for the building blocks. Disable any factory that has item price over the budget * left. */ private void UpdateBudgetAvailability() // Level { foreach (GameObject tileFactory in _tileFactories) { // check is budget enough for the factory to build the tile IsoDropZone isoDropZone = tileFactory.GetComponent <IsoDropZone>(); isoDropZone.SetEnable(IsBudgetAvailable(isoDropZone.ItemPrice)); } }
/** * Click finish */ void OnMouseUp() { if (EventSystem.current.IsPointerOverGameObject()) { return; // Block mouse clicks through a canvas } _dragging = false; _holdingItem = false; if (_newDropZones.Count > 0 && _newDropZones[0].droppableNames.Contains(this.name) ) // Dropped on a new available drop zone { if (dropZone != null) { dropZone.OnItemRemove(this); } _newDropZones[0].OnDrop(this); dropZone = _newDropZones[0]; _newDropZones.Clear(); } else if (_newDropZones.Count > 0 && !_newDropZones[0].droppableNames.Contains(this.name) ) // Dropped on a new unavailable drop zone { _newDropZones[0].OnDragExit(this); if (dropZone != null) { dropZone.OnDragFinish(this); } } else // Did not drop on any new drop zone { if (dropZone != null) { dropZone.OnDragFinish(this); } } MoveTo(homePos); // Move the block }
/** * Set the drop zone this block belongs too, executor */ public void SetDropZone(IsoDropZone list) { this.dropZone = list; }