Пример #1
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        if (GUILayout.Button("Save"))
        {
            ModelDataSerializer.SerializeDataModeltoDisc(shape.GetShapeData(), Application.persistentDataPath, shape.Name + "Data.xml");
            Debug.Log(Application.persistentDataPath);
        }
        if (GUILayout.Button("Load"))
        {
            var md = ModelDataSerializer.DeSerializeDataModelfromDisc(Application.persistentDataPath, shape.Name + "Data.xml");
            shape.SetShapeData(md);
        }
    }
Пример #2
0
    public void SpawnShape(int ID)
    {
        var shape     = Shapes.Find((s) => s.ID == ID);
        var shapeData = ModelDataSerializer.DeSerializeDataModelfromDisc(Application.persistentDataPath, shape.Name + "Data.xml");

        if (CurrentShape != null)
        {
            Destroy(CurrentShape.gameObject);
        }

        CurrentShape = Instantiate(shape);
        if (shapeData != null)
        {
            CurrentShape.SetShapeData(shapeData);
        }
    }