Ejemplo n.º 1
27
	public List<Tile> QueryForTileType (TileTypeController.TileType tileType) {
		List<Tile> result = new List<Tile> ();
		if (rootNode != null) {
			rootNode.QueryForTileType (result, tileType);
		}
		return result;
	}
Ejemplo n.º 2
3
	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;
    }
Ejemplo n.º 3
1
	public override void QueryForTileType (List<Tile> workingList, TileTypeController.TileType tileType) {
		if (this.tileType == tileType) {
			workingList.Add (this);
		}
	}
Ejemplo n.º 4
0
	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);
		}
	}
Ejemplo n.º 5
0
	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);
		}
	}
Ejemplo n.º 6
0
	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);
	}
Ejemplo n.º 7
0
	public void setState (CanAddr cAddr, TileTypeController.TileType tileType, float growthLevel) {
		if (rootNode == null) { rootNode = new Node(); }
		rootNode.setState(cAddr, tileType, growthLevel);
	}
Ejemplo n.º 8
0
	public abstract void QueryForTileType (List<Tile> workingList, TileTypeController.TileType tileType);
Ejemplo n.º 9
0
	public abstract void RegisterController (CanAddr cAddr, TileTypeController tTCont);
Ejemplo n.º 10
0
	public abstract void setState (CanAddr cAddr, TileTypeController.TileType tileType, float growthLevel);
Ejemplo n.º 11
0
	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);
			}
		}
	}
Ejemplo n.º 12
0
	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);
			}
		}
	}
Ejemplo n.º 13
0
	public override void RegisterController (CanAddr cAddr, TileTypeController tTCont) {
		this.tileCont = tTCont;
	}
Ejemplo n.º 14
0
	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);
	}