public TileEvent(string continent, int x, int y, TileEventType type) { Continent = continent; X = x; Y = y; Type = type; }
void PositionOnScreen() { Ray ray = Camera.main.ScreenPointToRay(new Vector3(Screen.width * xPostion, Screen.height * bottomOffset)); float distance; if (plane.Raycast(ray, out distance)) { transform.position = ray.GetPoint(distance); } ray = Camera.main.ScreenPointToRay(new Vector3(Screen.width * (xPostion - width / 2), Screen.height * bottomOffset)); if (plane.Raycast(ray, out distance)) { xMin = ray.GetPoint(distance); } ray = Camera.main.ScreenPointToRay(new Vector3(Screen.width * (xPostion + width / 2), Screen.height * bottomOffset)); if (plane.Raycast(ray, out distance)) { xMax = ray.GetPoint(distance); } for (int i = 0, l = transform.childCount; i < l; i++) { float f = i / (handSize - 1.0f); Transform child = transform.GetChild(i); TileEventType status = child.GetComponent <Tile>().Status; if (status == TileEventType.InHand || status == TileEventType.HandHovered) { child.position = Vector3.Lerp(xMin, xMax, f); } } }
private void Report(int x, int y, TileEventType type) { if (OnTileEvent != null) { OnTileEvent(this, new TileEvent(Continent, x, y, type)); } }
private void Tile_OnTileEvent(Tile tile, TileEventType eventType) { if (eventType == TileEventType.HandHovered && tile.tileType == ruleFor) { ApplyOn(HexCubMap.current, tile); } }
public void ReActivate() { mustBePlaced = true; _hovered = this; Status = TileEventType.HandHovered; Status = TileEventType.Dragged; }
private void Tile_OnTileEvent(Tile tile, TileEventType eventType) { if (eventType == TileEventType.Placed && tilesInHand.Contains(tile)) { RefillHand(1); tilesInHand.Remove(tile); } }
public TileEvent(TileEventType type, Board.Tile tile) : base(EventType.TileEvent) { this.tileEventType = type; this.tile = tile; this.largeItem = null; this.smallItem = null; }
private void Tile_OnTileEvent(Tile tile, TileEventType eventType) { if (tile == this && eventType == TileEventType.Placed) { if (closest) { closest.occupant = this; } else { Status = TileEventType.DragCancel; } } }
private void Tile_OnTileEvent(Tile tile, TileEventType eventType) { if (eventType == TileEventType.DragCancel || eventType == TileEventType.HandHoverCancel) { placements.Clear(); } else if (eventType == TileEventType.Placed) { Debug.Log("Placed " + tile); if (tile.tileType == TileType.Root) { HexPos pos = tile.Placement; Debug.Log("Looking for " + pos); bool fallOut = false; foreach (KeyValuePair <HexPos, HexPos[]> kvp in placements) { for (int i = 0, l = kvp.Value.Length; i < l; i++) { if (kvp.Value[i] == pos) { Debug.Log("Found it with " + kvp.Key); Tile meristem = kvp.Key.occupant; tile.Place(kvp.Key); meristem.Place(pos); fallOut = true; break; } } if (fallOut) { break; } } } placements.Clear(); } }
public TileEvent(string name, TileEventType type) { this.Name = name; this.Type = type; }
private void Report(int x, int y, TileEventType type) { if (OnTileEvent != null) OnTileEvent(this, new TileEvent(Continent, x, y, type)); }
public void Place(HexPos pos) { mustBePlaced = true; closest = pos; Status = TileEventType.Placed; }