Exemplo n.º 1
0
 private void CreateRoutes()
 {
     for (int x = 0; x < this.level.GetWidth(); ++x) {
         for (int y = 0; y < this.level.GetHeight(); ++y) {
             if (this.level.IsRoute(x, y)) {
                 if ( !level.ContainsInRoutes(x, y) ) {
                     Route route = new Route();
                     this.level.AddRoute(route);
                     this.AddNeighborRoute(route, x, y);
                     Vector3 center = this.MatrixToPosition(route.GetCenter());
                     GameObject lightPrefab = (GameObject)Resources.Load ("Prefabs/routeLightPrefab", typeof(GameObject));
                     GameObject light = (GameObject)Instantiate (lightPrefab, center + Vector3.up * 3, Quaternion.identity);
                     if (this.level.IsRoute((int)center.x, (int)center.y + 1) || this.level.IsRoute((int)center.x, (int)center.y - 1)) {
                         light.transform.Rotate(Vector3.up * 90);
                     }
                     light.transform.parent = levelObject.transform;
                 }
             }
         }
     }
 }