void Update() { if (activeGhost != null) { if (Input.GetMouseButtonUp(0)) { mouseDownCounts = true; } updateRaycast(); placeGhost(); if (Input.GetMouseButtonDown(0) && mouseDownCounts) { foreach (Coord coord in adjacentCoords) { if (activeGhost.CanBePlacedAt(coord.X, coord.Z)) { ItemLocationSelectedSignal itemLocationSelectedSignal = new ItemLocationSelectedSignal(activeGhost, coord.X, coord.Z); GameSceneSignalManager.Inst.FireSignal(itemLocationSelectedSignal); Destroy(activeGhost.gameObject); activeGhost = null; adjacentCoords = null; return; } } } } }
private void onItemIconClicked(Signal signal) { mouseDownCounts = false; ItemIconClickedSignal itemIconClickedSignal = (ItemIconClickedSignal)signal; updateRaycast(); activeGhost = Instantiate <ItemGhost>(itemIconClickedSignal.ItemIcon.ItemGhost); placeGhost(); }
public ItemLocationSelectedSignal(ItemGhost itemGhost, int x, int z) { this.ItemGhost = itemGhost; this.X = x; this.Z = z; }