Наследование: SuperTiled2Unity.Editor.TiledAssetImporter
Пример #1
0
    public void Reconfigure(MapEvent parent, SuperTiled2Unity.Editor.TmxAssetImporter importer)
    {
        @event = GetComponentInParent <MapEvent>();

        var            props = parent.Properties;
        CustomProperty prop;

        if (props.TryGetCustomProperty(PropertyItem, out prop))
        {
            itemKey = prop.GetValueAsString();
        }
        if (props.TryGetCustomProperty(PropertyVisible, out prop))
        {
            isInivisble = prop.GetValueAsString() != "VISIBLE";
        }
        if (props.TryGetCustomProperty(PropertyKeyItem, out prop))
        {
            isKey = prop.GetValueAsString() == "KEY_ITEM";
        }
        if (props.TryGetCustomProperty(PropertyCollectable, out prop))
        {
            isCollectable = true;
            itemKey       = prop.GetValueAsString();
        }
    }
Пример #2
0
    public void Reconfigure(MapEvent parent, SuperTiled2Unity.Editor.TmxAssetImporter importer)
    {
        collider = parent.GetComponent <PolygonCollider2D>();
        renderer = GetComponent <MeshRenderer>();
        filter   = GetComponent <MeshFilter>();
        @event   = parent.GetComponent <MapEvent>();

        var            props = parent.Properties;
        CustomProperty prop;

        if (props.TryGetCustomProperty(PropertyTileId, out prop))
        {
            tileId = prop.GetValueAsInt();
        }
        else
        {
            Debug.LogError("Bad ceiling " + parent);
        }
        if (props.TryGetCustomProperty(PropertyTileset, out prop))
        {
            var tilesetName = prop.GetValueAsString();
            var path        = TilesetDirectory + "/" + tilesetName + ".png";
            tilesetTexture = AssetDatabase.LoadAssetAtPath <Texture>(path);
        }
        else
        {
            Debug.LogError("Bad ceiling " + parent);
        }

        RecalculateUVs();
        renderer.material = GameboyMaterialSettings.GetDefault().BackgroundMaterial;

        RecalculateMesh(importer);
    }
Пример #3
0
    public void Reconfigure(MapEvent parent, SuperTiled2Unity.Editor.TmxAssetImporter importer)
    {
        var props = parent.Properties;

        if (props.TryGetCustomProperty(PropertyKeyItem, out CustomProperty prop))
        {
            itemKey = prop.GetValueAsString();
        }
    }
Пример #4
0
    public void RecalculateMesh(SuperTiled2Unity.Editor.TmxAssetImporter importer = null)
    {
        var mesh = RecalculateMesh(ContainsTile);

        if (importer != null)
        {
            var meshName = "Ceiling mesh " + @event.Position.x + "," + @event.Position.y;
            mesh.name = meshName;
            importer.SuperImportContext.AddObjectToAsset(meshName, mesh);
        }
    }