void Awake() { StreamReader sr = new StreamReader(Application.streamingAssetsPath + "/LD.txt"); string text = sr.ReadToEnd(); string[] lines = text.Split('\n'); string[] cases = lines[0].Split('\t'); _world = new WorldCase[cases.Length, lines.Length]; for (int j = 0; j < lines.Length; ++j) { cases = lines[j].Split('\t'); for (int i = 0; i < cases.Length; ++i) { _world[i, lines.Length - 1 - j]._type = WorldCase.CaseType.GRASS; _world[i, lines.Length - 1 - j]._passable = true; _world[i, lines.Length - 1 - j]._obj = null; WorldTilemap.SetCollision(i, lines.Length - 1 - j, false); switch (cases[i]) { case "C": _world[i, lines.Length - 1 - j]._type = WorldCase.CaseType.CABANE; _world[i, lines.Length - 1 - j]._passable = false; WorldTilemap.SetCollision(i, lines.Length - 1 - j, true); break; case "ROC": _world[i, lines.Length - 1 - j]._type = WorldCase.CaseType.ROCK; _world[i, lines.Length - 1 - j]._passable = false; WorldTilemap.SetCollision(i, lines.Length - 1 - j, true); break; case "TREE": _world[i, lines.Length - 1 - j]._type = WorldCase.CaseType.TREE; _world[i, lines.Length - 1 - j]._passable = false; WorldTilemap.SetCollision(i, lines.Length - 1 - j, true); break; case "P": _startCase.x = i; _startCase.y = lines.Length - 1 - j; break; case "OR": _world[i, lines.Length - 1 - j]._obj = Grabbable.CreateOfType(Grabbable.GrabbableType.NORMALBASE); break; case "FLA": _world[i, lines.Length - 1 - j]._obj = Grabbable.CreateOfType(Grabbable.GrabbableType.FLAMAND); break; case "BRA": _world[i, lines.Length - 1 - j]._obj = Grabbable.CreateOfType(Grabbable.GrabbableType.SOUTIF); break; case "VEN": _world[i, lines.Length - 1 - j]._obj = Grabbable.CreateOfType(Grabbable.GrabbableType.VENTILO); break; default: _world[i, lines.Length - 1 - j]._type = WorldCase.CaseType.GRASS; _world[i, lines.Length - 1 - j]._passable = true; break; } ; if (_world[i, lines.Length - 1 - j]._obj != null) { Vector3 p = WorldTilemap.PositionOfCase(i, lines.Length - 1 - j); p.z = -0.5f; _world[i, lines.Length - 1 - j]._obj.transform.position = p; } } } WorldTilemap.width = cases.Length; WorldTilemap.height = lines.Length; UpperTilemap.width = cases.Length; UpperTilemap.height = lines.Length; OverlayTilemap.width = cases.Length; OverlayTilemap.height = lines.Length; int currentCabaneSprite = 0; for (int j = 0; j < WorldTilemap.height; ++j) { for (int i = 0; i < WorldTilemap.width; ++i) { WorldTilemap.setIndex(i, j, 7); UpperTilemap.setIndex(i, j, -1); OverlayTilemap.setIndex(i, j, -1); switch (_world[i, j]._type) { case WorldCase.CaseType.GRASS: WorldTilemap.setIndex(i, j, Random.Range(6, 11)); break; case WorldCase.CaseType.CABANE: WorldTilemap.setIndex(i, j, currentCabaneSprite); currentCabaneSprite += 1; break; case WorldCase.CaseType.ROCK: UpperTilemap.setIndex(i, j, 3); break; case WorldCase.CaseType.TREE: UpperTilemap.setIndex(i, j, 2); break; default: break; } ; } } WorldTilemap.MakeTilemap(); UpperTilemap.MakeTilemap(); OverlayTilemap.MakeTilemap(); WorldTilemap.transform.position = Vector3.zero; UpperTilemap.transform.position = Vector3.zero - Vector3.forward * 0.5f; OverlayTilemap.transform.position = Vector3.zero - Vector3.forward * 0.7f; }