void Start()
    {
        interfaceHandler = FindObjectOfType <DMInterfaceHandler>();
        materialsHandler = FindObjectOfType <DMMaterialsHandler>();

        placementDropdown.onValueChanged.AddListener(delegate
        {
            UpdatePlacementIndex();
        });

        GameObject[] prefabs = Resources.LoadAll <GameObject>("Prefabs/");

        foreach (GameObject prefab in prefabs)
        {
            GameObject go = Instantiate(prefab);
            go.name = prefab.name;
            OnNewPlaceableObject(go);
        }
    }
Example #2
0
    private void Start()
    {
        actionHandler    = FindObjectOfType <DMActionHandler>();
        creationHandler  = FindObjectOfType <DMCreationHandler>();
        selectionHandler = FindObjectOfType <DMSelectionHandler>();
        materialsHandler = FindObjectOfType <DMMaterialsHandler>();

        List <string> selectionNames = new List <string>();
        int           c = 1;

        foreach (var m in Enum.GetNames(typeof(Mode)))
        {
            selectionNames.Add("(" + c.ToString() + ") " + m);
            c++;
        }
        selectionModeDropdown.AddOptions(selectionNames);

        selectionModeDropdown.onValueChanged.AddListener(delegate
        {
            ChangeMode(selectionModeDropdown.value);
        });
    }