예제 #1
0
    // Where combinedSlotNumWorldType is: saveSlotNum worldType
    // For example if the save slot number is 4 and the world type is Adventure then:
    // combinedSlotNumWorldType = 4Adventure = 41
    public void StartGameButton(int combinedSlotNumWorldType)
    {
        WorldData.WorldType worldType;
        DecodeCombinedInt(in combinedSlotNumWorldType, out saveSlotNum, out worldType);
        if (singleplayerData.saveSlots[saveSlotNum] == null)
        {
            // Start new game:
            worldData.ResetAllWorldData();
            playerCharacterData.ResetAllPlayerCharacterPersistentData();

            worldData.SetWorldType(worldType);
            masterManager.SaveGame(saveSlotNum, playerCharacterData);
            sceneLoader.AsyncLoadSceneByIndex(8);
        }
        else
        {
            // Load game:
            masterManager.LoadGame(saveSlotNum, playerCharacterData);
            alphaMask.enabled           = true;
            saveSlotsMenuCanvas.enabled = true;
            InitSaveSlot(singleplayerData.saveSlots[saveSlotNum], saveSlotsText, saveSlotNum);
        }
    }