internal void init(CaveComponent m) { transform.localScale *= 1.5f; rand = new System.Random(); body = GetComponent <Rigidbody>(); gameObject.SetActive(false); master = m; }
internal Sector(CaveMeshes caveMeshes, string index) { GameObject = new GameObject(AppendIndex("Sector", index)); GameObject.SetActive(false); Ceiling = new Ceiling(caveMeshes.Ceiling, AppendIndex("Ceiling", index)); Walls = new Walls(caveMeshes.Walls, AppendIndex("Walls", index)); Floor = new Floor(caveMeshes.Floor, AppendIndex("Floor", index)); AddChild(Ceiling); AddChild(Walls); AddChild(Floor); }
int destDepth;//the depth the cave entrance ends at internal void tunnelFrom(CaveBody body) { source = body; int n = rand.Next(0, 2); int count = 0; Vector3 dir = Vector3.zero; foreach (int nei in MapManager.manager.neighboursMap[body.centerColumnID]) { if (count == n) { dir = MapManager.manager.getPositionOf(0, nei) - MapManager.manager.getPositionOf(0, body.centerColumnID); break; } count++; } tunnelFrom(body, dir); }
void AddChild(CaveComponent component) { component.GameObject.transform.parent = GameObject.transform; }