using System.Collections; using System.Collections.Generic; using UnityEngine; using System.IO; using System.Threading.Tasks; public enum Unlockable { None, Bubuus, } public enum Status { Normal, Farty, Horny, Drunk, Moody, } [System.Serializable] public class GameData { // Whether or not the game's Red Tag content is available. // Red Tag is the supporter-only version of the game. // It unlocks heavy fetish content in special scenes. public static bool RED_TAG = false; public bool isNewGame = true; // Set temporarily when the game first notices that you've unlocked all the content. // Should show a special scene. public bool hasShownWinScene = false; public int money = 100000; public int day = 15; public int time = 1; public int mood = 4; public int hunger = 0; public int affection = 55550; public int fartCounter = 0; public Status status = Status.Normal; public bool workedToday = false; public bool boughtFood = false; public bool ranAway = false; public Body bodyChoice = Body.Undies; public Hair hairChoice = Hair.Messy; public HashSet tasksDoneToday = new HashSet(); // Populated when the Manager notices that you've unlocked a new version of a task. // See ManagerController.NotifyTaskUnlocks. public HashSet notifiedTaskUnlocks = new HashSet() { Dialogue.None, Dialogue.Task_Clean1, Dialogue.Task_Games1, Dialogue.Task_Suck1, }; public HashSet unlocked = new HashSet() { }; public HashSet unlockedOutfits = new HashSet() { Body.Undies }; public HashSet unlockedHairs = new HashSet() { Hair.Messy }; public HashSet forSaleOutfits = new HashSet(); public HashSet forSaleHairs = new HashSet(); public HashSet viewedScenes = new HashSet(); public Dictionary characterNames = new Dictionary() { { Character.None, "" }, { Character.Her, "Bitch" }, { Character.You, "Player" }, { Character.OldRoommate, "Jeanine" } }; public GameData() {} // Populate the for-sale outfits and hairs according to game progress. public void UpdateForSale() { forSaleOutfits.Clear(); forSaleHairs.Clear(); MaybeAddOutfitForSale(Body.EmoUndies, 2, 1000); MaybeAddOutfitForSale(Body.Rockstar, 5, 3000); MaybeAddOutfitForSale(Body.Swimsuit, 8, 5500); MaybeAddOutfitForSale(Body.Messy, 11, 8000); MaybeAddOutfitForSale(Body.Business, 14, 10000); MaybeAddOutfitForSale(Body.Devil, 17, 15000); MaybeAddHairForSale(Hair.Bratty, 3, 2000); MaybeAddHairForSale(Hair.Pigtails, 6, 5500); MaybeAddHairForSale(Hair.PrimProper, 13, 11500); MaybeAddHairForSale(Hair.FizzyPop, 18, 17500); } private void MaybeAddOutfitForSale(Body _outfit, int minDay, int minAffection) { if (!unlockedOutfits.Contains(_outfit) && day >= minDay && affection >= minAffection ) { forSaleOutfits.Add(_outfit); } } private void MaybeAddHairForSale(Hair _hair, int minDay, int minAffection) { if (!unlockedHairs.Contains(_hair) && day >= minDay && affection >= minAffection ) { forSaleHairs.Add(_hair); } } // Whether you've done everything: all outfits, all hairs, all tasks. public bool CheckWin() { for (int i = 1; i < System.Enum.GetNames(typeof(Body)).Length; i++) { if (!unlockedOutfits.Contains((Body)i)) return false; } for (int i = 1; i < System.Enum.GetNames(typeof(Hair)).Length; i++) { if (!unlockedHairs.Contains((Hair)i)) return false; } foreach (var progressionKey in VNData.TASK_INFO.Keys) { foreach (AssignedTaskInfo info in VNData.TASK_INFO[progressionKey]) { if (info.dialogue != Dialogue.None && !viewedScenes.Contains(info.dialogue)) return false; } } return true; } public static bool IsUnlocked(Unlockable u) { return GLOBAL.unlocked.Contains(u); } public static void Unlock(Unlockable u) { GLOBAL.unlocked.Add(u); } public static GameData GLOBAL = new GameData(); public static void Save() { Debug.Log("Save"); ES3.Save("save", GameData.GLOBAL); } public static bool Load() { Debug.Log("Save"); ES3.LoadInto("save", GameData.GLOBAL); return true; } public void Feed(Food food) { ItemInfo foodInfo = VNData.FOOD_INFO[food]; hunger -= foodInfo.hunger; if (hunger < 0) hunger = 0; mood += foodInfo.mood; if (mood < 0) mood = 0; if (mood > 4) mood = 4; affection += foodInfo.affection; if (foodInfo.fartiness > 0f && Random.Range(0f,1f) < foodInfo.fartiness) { // uh-oh spaghetti-o's fartCounter = 2; status = Status.Farty; } } public void IncrementTime() { boughtFood = false; ranAway = false; if (time == 4) { time = 1; day += 1; workedToday = false; tasksDoneToday.Clear(); if (status == Status.Moody) { status = Status.Normal; } if (day > 1 && day % 3 == 1) { // Pay the bills every third day, starting day 4. money -= 200; } } else { time += 1; } if (fartCounter == 0 && status == Status.Farty) { status = Status.Normal; } fartCounter -= 1; if (fartCounter < 0) { fartCounter = 0; } // Process mood if (hunger > 2 || Random.Range(0f, 1f) < 0.3f) { mood -= 1; } if (mood < 1) { mood = 0; status = Status.Moody; } // Process hunger hunger += 1; if (hunger > 4) { // Going too long without feeding her triggers a runaway event. // She steals your credit card and takes a cab to take herself out to dinner. // She also becomes moody and won't cooperate with you for a full day. ranAway = true; mood = 0; hunger = 0; status = Status.Moody; money -= 200; } } }