private WorldTileSurface GetWorldTileSurfacePrefab() { GameObject worldTileSurfacePrefab = Resources.Load("WorldTileSurface") as GameObject; WorldTileSurface worldTileSurface = worldTileSurfacePrefab.GetComponent <WorldTileSurface>(); return(worldTileSurface); }
private void CreateWalkablePlanes() { // First destroy old walkable planes DestroyWalkablePlanes(); for (int i = 0; i < surfaceRotations.SurfaceRotationList.Count; i++) { float worldTileHalfSize = GetComponent <Renderer>().bounds.size.x / 2f; float offset = worldTileHalfSize + walkablePlaneDistance; SurfaceRotation surfaceRotation = surfaceRotations.SurfaceRotationList[i]; WorldTileSurface walkablePlane = Instantiate(GetWorldTileSurfacePrefab()); walkablePlane.transform.parent = transform; walkablePlane.Setup(surfaceRotation, offset); surfaces.Add(walkablePlane); } }