public virtual void SaveToSelectedSlot()
        {
            var slot = slotManager.selectedSlot;

            if (slot == null)
            {
                return;
            }

            var newSaveData = gameSaver.CreateSave(slot.Number);

            saveManager.AddSave(newSaveData);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates and registers new save data with the passed slot number, then writing it to disk
        /// if set to do so. Save replacement may happen depending on the aforementioned number.
        /// </summary>
        public virtual bool AddSave(int slotNumber, bool writeToDisk = true)
        {
            if (!savingEnabled)
            {
                if (warnOnUnallowedSave)
                {
                    Debug.LogWarning(this.name + "'s SaveManager is set to not add saves.");
                }
                return(false);
            }

            var newSaveData = gameSaver.CreateSave(slotNumber);

            return(AddSave(newSaveData, writeToDisk));
        }