Exemple #1
0
    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);
    }