Ejemplo n.º 1
0
        public virtual void FetchLevels()
        {
            for (int i = 0; i < LevelEditorSaveSlot.slots.Count; i++)
            {
                Destroy(LevelEditorSaveSlot.slots[i].gameObject);
            }
            LevelEditorSaveSlot.slots.Clear();

            var levels = GetLevels();

            for (int i = 0; i < levels.Length; i++)
            {
                LevelEditorSaveSlot.CreateInstance(saveSlotsParent, saveSlotPrefab, Path.GetFileNameWithoutExtension(levels[i]), levels[i]);
            }
        }
Ejemplo n.º 2
0
        public virtual void LoadSave(LevelEditorSaveSlot slot)
        {
            if (slot == null)
            {
                return;
            }

            UCSavingManager.enabled = true;

            UCSavingManager.fileName = slot.saveText.text;
            UCSavingManager.Load();

            LevelEditorController.canMove = true;

            EnableCreate(false);
            EnablePanel(false);
        }
        public static LevelEditorSaveSlot CreateInstance(Transform parent, GameObject slot, string name, string path)
        {
            GameObject instance = GameObject.Instantiate(slot);

            instance.transform.SetParent(parent);

            instance.transform.localPosition = Vector3.zero;
            instance.transform.localScale    = Vector3.one;

            LevelEditorSaveSlot script = instance.GetComponent <LevelEditorSaveSlot>();

            if (script == null)
            {
                return(null);
            }

            script.saveText.text = name;
            script.savePath      = path;

            return(script);
        }