public readonly List <Leaf> connections = new List <Leaf>(); // позиции другими полям public Leaf(float x, float z, float width, float length) { // инициализация листа this.x = x; this.z = z; this.width = width; this.length = length; LevelGraph l = LevelGraph.levelGraph; Vector3 start = l.transform.position + new Vector3(x, 0, z); Debug.DrawLine(start, start + new Vector3(width, 0, 0), Color.red, 100000); Debug.DrawLine(start, start + new Vector3(0, 0, length), Color.red, 100000); Debug.DrawLine(start + new Vector3(width, 0, 0), start + new Vector3(width, 0, length), Color.red, 100000); Debug.DrawLine(start + new Vector3(0, 0, length), start + new Vector3(width, 0, length), Color.red, 100000); }
[NonSerialized] public BattleController battle; // ссылка на контроллер битвы IEnumerator Start() { levelGraph = this; // быстрая ссылка battle = GetComponent <BattleController>(); // ссылка на контроллер битвы GenerateLevel(); // генерация уровня player = FindObjectOfType <Player>(); // поиск игрока if (player == null) { Debug.LogWarning("Player wasn't found"); yield break; } yield return(null); // подождать инициализацию полей, чтобы покрасить цвет первых полей (= meshRenderer, ждать Start один кадр) player.Initialize(); // инициализация игрока }