Example #1
0
    void Start()
    {
        grid = GetComponent <Grid>();

        // spawn a new layer to start working with
        CreateLayer("default");
        // select a initially equipped tile
        activeTile = MapEditorHelper.Instance.GetTiles()[0];
        if (activeTile == null)
        {
            Debug.LogError("no tiles in registry available for equipping, check MapEditorHelper settings");
        }

        // print out save files
        Debug.Log("Save files: " + MapEditorHelper.ListToString(MapEditorHelper.Instance.GetSaveFileNames()));
    }
Example #2
0
    // enforce singleton
    void OnEnable()
    {
        MapEditorHelper[] h     = Resources.FindObjectsOfTypeAll <MapEditorHelper>();
        MapEditorHelper   first = h.FirstOrDefault();

        Debug.Log("MapEditorHelpers found: " + ListToString(h));
        if (h.Length == 0)
        {
            Debug.LogError("found no MapEditorHelper asset, needs at least one in scene, using default");
        }
        else if (h.Length != 1)
        {
            Debug.LogError("found more than 1 MapEditorHelper asset in resources, there should only be one, will use first found:" + first);
        }
        Instance = first;

        // load the tileset
        LoadTileset();
    }