/// <summary> ////////////////// Saker som inte används ////////////////// /// </summary> void AngleExtrusion(){ popArea tempVector = new popArea(); int newNodeAngle = Random.Range(0,4); switch (newNodeAngle) { case 0: newNodeAngle = 45; break; case 1: newNodeAngle = 135; break; case 2: newNodeAngle = 225; break; case 3: newNodeAngle = 315; break; default: //Debug.Log ("number is not between 0 and 2"); break; } clone = Instantiate(Node, randomPos, Quaternion.Euler(new Vector3(0,newNodeAngle,0))) as GameObject; clone.name = "AngleExtrusion"; AddNodeToDict("AngleExtrusion", clone.transform.position); Destroy(clone); tempVector.cityX = (int)randomPos.x; tempVector.cityY = (int)randomPos.z; for (int a = 0; a < populatedArea.Count; a++){ if (populatedArea.Contains(tempVector)) { clone.transform.Translate(Vector3.forward*1); tempVector.cityX = (int)clone.transform.position.x; tempVector.cityY = (int)clone.transform.position.z; } else { break; } } }
void populatedPixels(){ // populateArea = lista över svarta pixlar (mark) popArea temp = new popArea(); for (int y = 0; y < cityMapBW.height; y++){ for (int x = 0; x < cityMapBW.width; x++){ curPixGray = cityMapBW.GetPixel(x,y).grayscale; if (curPixGray < 0.5){ temp.cityX = x; temp.cityY = y; populatedArea.Add(temp); } else { //Inte svart, lägg ej till } } } }