void Awake()
    {
        // First we check if there are any other instances conflicting
        if(Instance != null && Instance != this)
        {
            // If that is the case, we destroy other instances
            Destroy(gameObject);
        }

        // Here we save our singleton instance
        Instance = this;

        // Create default terrain area
        terrainAreas = new Dictionary<Color, TerrainArea> ();
        terrainAreas.Add (Color.white, newDefaultTerrainArea());
    }
Ejemplo n.º 2
0
    void Start()
    {
        //Dictionaries cant be initialized in the inspector. So we initialize it here with the values given in inspector for the list
        terrainAreaButtonsByColor = new Dictionary<Color, TerrainAreaButton> ();
        foreach (GameObject button in terrainAreaButtons) {
            TerrainAreaButton component = button.GetComponent<TerrainAreaButton>();
            terrainAreaButtonsByColor.Add(component.colorKey, component);
        }

        // Get references to managers
        TCM = TerrainCharacteristicsManager.Instance;
        CL = ChunkLoader.Instance;

        // Select the initial defaul area
        SetSelectedTerrainArea (Color.white, false);
    }