public void CreateNodesFromLevelOptions() { btLevelOptions levelOptions = Object.FindObjectOfType(typeof(btLevelOptions)) as btLevelOptions; if (levelOptions == null) { Debug.LogError("Could not find level options object"); return; } if (levelOptions.allowedNodes == null || levelOptions.allowedNodes.Length == 0) { Debug.LogError("No allowed nodes defined in level options"); } else { foreach (btInterfaceTreeManager.INODE_TYPE nodeType in levelOptions.allowedNodes) { btNodeSelectTile tile = this.CreateNewTile(nodeType); tile.transform.localPosition = new Vector3(this.tileList.Count * tileSize.x, 0.0f, 0.0f); this.tileList.Add(tile); tile.SetLock(true); } } this.panel.clipRange = new Vector4(((float)(this.tileList.Count - 1) / 2.0f) * this.tileSize.x, 0.0f, (float)(Mathf.Max(this.tileList.Count, 4)) * this.tileSize.x, this.tileSize.y); }
private void Awake() { if (btGameManager.instance != null) { Debug.LogError("Multiple instances of btGameManager found"); } btGameManager.instance = this; // Find the options and stash them btLevelOptions levelOptions = GameObject.FindObjectOfType(typeof(btLevelOptions)) as btLevelOptions; Assert.IsNotNull(levelOptions, "Level Options not found"); this.levelNumber = levelOptions.levelNumber; this.levelName = levelOptions.levelName; this.levelDescription = levelOptions.levelDescription; this.levelHint = levelOptions.levelHint; }
private void Awake() { #if UNITY_EDITOR /// Check for other managers if (btTileManager.instance != null) { Debug.LogError("Multiply defined TileManager", this.gameObject); Debug.LogError("Multiply defined TileManager", btTileManager.instance.gameObject); return; } #endif btTileManager.instance = this; /// FInd the board dimensions using the options for the level btLevelOptions levelOptions = GameObject.FindObjectOfType(typeof(btLevelOptions)) as btLevelOptions; if (levelOptions == null) { Debug.LogError("Could not find options for level"); } else { this.tilesHorizontal = levelOptions.tilesHorizontal; this.tilesVertical = levelOptions.tilesVertical; } /// Populate tile grid this.tileGrid = new List <List <btBoardSpace> >(); for (int y = 0; y < this.tilesVertical; ++y) { this.tileGrid.Add(new List <btBoardSpace>()); for (int x = 0; x < this.tilesHorizontal; ++x) { this.tileGrid[y].Add(new btBoardSpace(x, y)); } } this.tileMovements = new List <btTileMovement>(); }