public List<Tile> QueryForTileType (TileTypeController.TileType tileType) { List<Tile> result = new List<Tile> (); if (rootNode != null) { rootNode.QueryForTileType (result, tileType); } return result; }
public GameObject GetPrefabOfType(TileTypeController.TileType type) { if (m_tilePrefabs == null || m_tilePrefabs.Count == 0) { Debug.Log("GetPrefabOfType: No Prefabs Set"); return null; } foreach(GameObject obj in m_tilePrefabs) { TilePrefabID id = obj.GetComponent<TilePrefabID>(); if (id == null) { Debug.Log("GetPrefabOfType: Prefab has no TilePrefabID"); return null; } if (id.m_type == type) { return obj; } } Debug.Log("GetPrefabOfType: No prefab with requested type found"); return null; }
public override void QueryForTileType (List<Tile> workingList, TileTypeController.TileType tileType) { if (this.tileType == tileType) { workingList.Add (this); } }
public override void RegisterController (CanAddr cAddr, TileTypeController tTCont) { int childIndex = (int) cAddr.getTuple(this.aggLev - 1); if (children[childIndex] == null) { if (this.aggLev == 1) { this.children[childIndex] = new Tile (this, childIndex); this.children[childIndex].RegisterController(cAddr, tTCont); } else { this.children[childIndex] = new Node (this, childIndex); this.children[childIndex].RegisterController(cAddr, tTCont); } } else { children[childIndex].RegisterController(cAddr, tTCont); } }
public override void setState (CanAddr cAddr, TileTypeController.TileType tileType, float growthLevel) { int childIndex = (int) cAddr.getTuple(this.aggLev - 1); if (children[childIndex] == null) { if (this.aggLev == 1) { this.children[childIndex] = new Tile (this, childIndex); this.children[childIndex].setState(cAddr, tileType, growthLevel); } else { this.children[childIndex] = new Node (this, childIndex); this.children[childIndex].setState(cAddr, tileType, growthLevel); } } else { children[childIndex].setState(cAddr, tileType, growthLevel); } }
public void RegisterTile (Vector3 worldPos, TileTypeController.TileType tileType, float growthLevel, TileTypeController tileController) { CanAddr cAddr = GridController.WorldToGrid (worldPos); //this.setState (cAddr, tileType, growthLevel); this.rootNode.RegisterController (cAddr, tileController); }
public void setState (CanAddr cAddr, TileTypeController.TileType tileType, float growthLevel) { if (rootNode == null) { rootNode = new Node(); } rootNode.setState(cAddr, tileType, growthLevel); }
public abstract void QueryForTileType (List<Tile> workingList, TileTypeController.TileType tileType);
public abstract void RegisterController (CanAddr cAddr, TileTypeController tTCont);
public abstract void setState (CanAddr cAddr, TileTypeController.TileType tileType, float growthLevel);
public override void QueryForTileType (List<Tile> workingList, TileTypeController.TileType tileType) { for (int i = 0; i < Node.NUM_CHILDREN; i++) { if (this.children [i] != null) { this.children [i].QueryForTileType (workingList, tileType); } } }
public void UpdateTileViz (TileTypeController TC) { if (TC != null) { if (this.presentVine != null) { TC.UpdateTileState (this.tileType, this.growthLevel, this.presentVine.dirs); } else { int[] dirs = { 0 }; TC.UpdateTileState (this.tileType, this.growthLevel, dirs); } } }
public override void RegisterController (CanAddr cAddr, TileTypeController tTCont) { this.tileCont = tTCont; }
public override void setState (CanAddr cAddr, TileTypeController.TileType tileType, float growthLevel) { if (tileType == TileTypeController.TileType.TILE_BLANK || tileType == TileTypeController.TileType.TILE_FLOWERS || tileType == TileTypeController.TileType.TILE_WEEDS || tileType == TileTypeController.TileType.TILE_VINE || tileType == TileTypeController.TileType.TILE_TREE) { this.isActiveType = true; } else { this.isActiveType = false; } if (tileType != TileTypeController.TileType.TILE_VINE && this.tileType == TileTypeController.TileType.TILE_VINE) { this.tileType = tileType; this.presentVine.killChildren(); this.presentVine = null; } if (this.tileType != TileTypeController.TileType.TILE_VINE && tileType == TileTypeController.TileType.TILE_VINE) { this.presentVine = new Vine (); this.presentVine.owningTile = this; } this.tileType = tileType; this.growthLevel = growthLevel; this.growthState = Tile.getGrowthStateForLevel (this.growthLevel); this.fillOutRef (); this.UpdateTileViz (this.tileCont); }