// nucleus grows tissue cell around it like a grower void EndTurn(object args) { TileQuery q = new TileQuery (); TileBehavior tile = q.FindRandomEmptyAdjacent ((int)this.transform.position.x, (int)transform.position.y); if (tile != null) { tile.Cell = colony.MakeCell(CellTypeData.Empty, tile.x, tile.y); } }
public void HighlightBuildableCells() { ClearHighlights (); TileQuery q = new TileQuery (); List<TileBehavior> res = q.FindBuildableTiles (); foreach (TileBehavior tb in res) { GameObject clone = (GameObject)Instantiate(highlight); clone.transform.parent = tb.transform; clone.transform.position = tb.transform.position; highlights.Push(clone); } }
// Use this for initialization new void Start() { base.Start (); endTurnDelegate = new EventDelegate (EndTurn); Events.Listen ("EndTurn", endTurnDelegate); Colorize (); colony.Nucleus = this; tileGrid = GameObject.Find ("grid").GetComponent<TileGrid> (); TileQuery q = new TileQuery (); q.FindTileAt (tileGrid.width / 2, tileGrid.height / 2).Cell = this; this.transform.position = new Vector2 (tileGrid.width / 2, tileGrid.height / 2); }
void OnMouseDown() { TileQuery q = new TileQuery (); if (!q.CanBuildAt (x, y)) { return; } CellChoiceBehavior[] behaviors = FindObjectsOfType<CellChoiceBehavior> (); foreach (CellChoiceBehavior b in behaviors) { if (b.IsSelected) { ColonyBehavior colony = GameObject.Find ("colony").GetComponent<ColonyBehavior> (); cell = colony.MakeCell (b.CellType, x, y); } } // new cell was created if (cell != null) { Events.Trigger ("PlaceCell", cell); } }