public static void PlanNotification(PetGlobal pet) { TimeSpan smallestTimespan = degenerationPrediction(pet); Debug.LogWarning("Crisis message in: " + smallestTimespan.ToString()); // Determined what notification to send, following is sending the notification: NotificationManager.CancelAll(); if (messageType == 1) { NotificationManager.SendWithAppIcon(smallestTimespan, "Augotchi hunger", "Your pet is literalyy starving rn", new Color(1f, 0f, 0f), NotificationIcon.Clock); } else if (messageType == 2) { NotificationManager.SendWithAppIcon(smallestTimespan, "Augotchi happiness", "Your pet is literally suicidal rn", new Color(1f, 0f, 0f), NotificationIcon.Clock); } else if (messageType == 3) { NotificationManager.SendWithAppIcon(smallestTimespan, "Augotchi health", "Your pet is literally drowning in fat rn", new Color(1f, 0f, 0f), NotificationIcon.Clock); } else { Debug.LogWarning("Something went horribly wrong with sending a notification! Could not determine smallest!"); } }
private void Start() { PetGlobal pg = new PetGlobal(); filterUnlocks(pg.LoadUnlocks()); buildPet(pg.LoadVisuals()); }
private static TimeSpan degenerationPrediction(PetGlobal pet) { long ticks = 0; float hunger = pet.hunger; float happiness = pet.happiness; float health = pet.health; while (hunger > 25f && health > 25f && happiness > 35f) { hunger -= (PetKeeper.pet.DECAY_HUNGER * 360); health -= (PetKeeper.pet.DECAY_HEALTH * 360); if (hunger < 25) { happiness -= (0.02f * 360); } if (health < 25) { happiness -= (0.02f * 360); } if (hunger > 75) { happiness += (0.01f * 360); } if (health > 75) { happiness += (0.01f * 360); } happiness -= (PetKeeper.pet.DECAY_HAPPINESS * 360); ticks += 360; } if (hunger < 25) { messageType = 1; } if (happiness < 25) { messageType = 2; } if (health < 25) { messageType = 3; } return(new TimeSpan(ticks * TimeSpan.TicksPerSecond * 10)); }
public void onWorldClick() { PetGlobal pg; GameObject petKeeper = GameObject.FindGameObjectWithTag("PetKeeper"); if (petKeeper == null) { pg = new PetGlobal(); pg.SaveVisuals(pvd); } else { PetKeeper.pet.SaveVisuals(pvd); } GameControl.markerPicked = true; SceneManager.LoadScene("World"); }
public PetUnlocksData LoadUnlocks() { if (File.Exists(Application.persistentDataPath + "/AugotchiSave.gd")) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Application.persistentDataPath + "/AugotchiSave.gd", FileMode.Open); PetGlobal pg = (PetGlobal)bf.Deserialize(file); file.Close(); if (pg.petUnlocksData != null) { if (pg.petUnlocksData.unlockedHats.Length < PetUnlocksData.hatCounts.Length) { int[] expandedArray = new int[PetUnlocksData.hatCounts.Length]; for (int i = 0; i < pg.petUnlocksData.unlockedHats.Length; i++) { expandedArray[i] = pg.petUnlocksData.unlockedHats[i]; } pg.petUnlocksData.unlockedHats = expandedArray; } if (pg.petUnlocksData.unlockedFaces.Length < PetUnlocksData.faceCounts.Length) { int[] expandedArray = new int[PetUnlocksData.faceCounts.Length]; for (int i = 0; i < pg.petUnlocksData.unlockedFaces.Length; i++) { expandedArray[i] = pg.petUnlocksData.unlockedFaces[i]; } pg.petUnlocksData.unlockedFaces = expandedArray; } return(pg.petUnlocksData); } else { return(new PetUnlocksData()); } } else { return(new PetUnlocksData()); } }
public void Start() { PetGlobal pg; GameObject petKeeper = GameObject.FindGameObjectWithTag("PetKeeper"); if (petKeeper == null) { pg = new PetGlobal(); pvd = pg.LoadVisuals(); } else { pvd = PetKeeper.pet.LoadVisuals(); } apparelUI.pvd = pvd; earPicker.transform.GetChild(1).GetComponent <Text>().text = (pvd.earsIndex + 1) + "/" + petFactory.ears.Length; eyePicker.transform.GetChild(3).GetComponent <Text>().text = (pvd.eyesIndex + 1) + "/" + petFactory.eyes.Length; eyePicker.transform.GetChild(7).GetComponent <Text>().text = (pvd.eyesSizeIndex + 1) + "/" + petFactory.eyes[pvd.eyesIndex].textures.Length; tailPicker.transform.GetChild(1).GetComponent <Text>().text = (pvd.tailIndex + 1) + "/" + petFactory.tails.Length; whiskersPicker.transform.GetChild(1).GetComponent <Text>().text = (pvd.whiskersIndex + 1) + "/" + petFactory.whiskers.Length; nosePicker.transform.GetChild(1).GetComponent <Text>().text = (pvd.noseIndex + 1) + "/" + petFactory.noses.Length; basePicker.transform.GetChild(2).GetComponent <Text>().text = (pvd.baseTextureIndex + 1) + "/" + petFactory.baseTextures.Length; basePicker.transform.GetChild(5).GetComponent <Text>().text = (pvd.baseTint + 1) + "/" + PetVisualData.palette.Length; basePicker.transform.GetChild(8).GetComponent <Image>().color = PetVisualData.palette[pvd.baseTint]; overlayPicker.transform.GetChild(2).GetComponent <Text>().text = (pvd.overlayBlendIndex + 1) + "/" + petFactory.overLayBlends.Length; overlayPicker.transform.GetChild(5).GetComponent <Text>().text = (pvd.overlayTint + 1) + "/" + PetVisualData.palette.Length; overlayPicker.transform.GetChild(8).GetComponent <Image>().color = PetVisualData.palette[pvd.overlayTint]; overlayPicker.transform.GetChild(10).GetComponent <Text>().text = (pvd.overlayTextureIndex + 1) + "/" + petFactory.baseTextures.Length; detailsPicker.transform.GetChild(2).GetComponent <Text>().text = (pvd.detailsBlendIndex + 1) + "/" + petFactory.detailsBlends.Length; detailsPicker.transform.GetChild(5).GetComponent <Text>().text = (pvd.DetailsTint + 1) + "/" + PetVisualData.palette.Length; detailsPicker.transform.GetChild(8).GetComponent <Image>().color = PetVisualData.palette[pvd.DetailsTint]; detailsPicker.transform.GetChild(9).GetComponent <Text>().text = (pvd.detailsTextureIndex + 1) + "/" + petFactory.baseTextures.Length; stage = 0; petFactory.buildPet(pvd); }
public static void PlanNotification(PetGlobal pet) { NotificationManager.CancelAll(); TimeSpan deathTimespan; if (pet.isDead) { NotificationManager.SendWithAppIcon(new TimeSpan(23, 0, 0), pet.name + " has passed out!", "Revive by taking a walk!", new Color(1f, 0f, 0f), NotificationIcon.Clock); return; } if (pet.hunger <= 25 || pet.health <= 25 || pet.happiness <= 25) { NotificationManager.SendWithAppIcon(new TimeSpan(12, 0, 0), pet.name + " is in critical condition!", "Oh no, that is not good...", new Color(1f, 0f, 0f), NotificationIcon.Clock); return; } TimeSpan smallestTimespan = degenerationPrediction(pet); Debug.LogWarning("Crisis message in: " + smallestTimespan.ToString()); // Determined what notification to send, following is sending the notification: if (messageType == 1) { NotificationManager.SendWithAppIcon(smallestTimespan, pet.name + " is hungry!", "Feed " + pet.name + " some food!", new Color(1f, 0f, 0f), NotificationIcon.Clock); } else if (messageType == 2) { NotificationManager.SendWithAppIcon(smallestTimespan, pet.name + " is sad!", "Pet " + pet.name + " or use some candy!", new Color(1f, 0f, 0f), NotificationIcon.Clock); } else if (messageType == 3) { NotificationManager.SendWithAppIcon(smallestTimespan, pet.name + " needs exercise!", "Take " + pet.name + " for a walk and improve both of your health!", new Color(1f, 0f, 0f), NotificationIcon.Clock); } else { Debug.LogWarning("Something went horribly wrong with sending a notification! Could not determine smallest!"); } NotificationManager.SendWithAppIcon(new TimeSpan(12, 0, 0), pet.name + " is in critical condition!", "Oh no, that is not good...", new Color(1f, 0f, 0f), NotificationIcon.Clock); }
public PetVisualData LoadVisuals() { if (File.Exists(Application.persistentDataPath + "/AugotchiSave.gd")) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Application.persistentDataPath + "/AugotchiSave.gd", FileMode.Open); PetGlobal pg = (PetGlobal)bf.Deserialize(file); file.Close(); if (pg.petVisualData != null) { return(pg.petVisualData); } else { return(new PetVisualData()); } } else { return(new PetVisualData()); } }
void Start() { if (GameObject.FindGameObjectsWithTag("PetKeeper").Length > 1) { Destroy(gameObject); return; } DontDestroyOnLoad(gameObject); pedometer = new Pedometer(this.OnStep); pet = new PetGlobal(); if (!pet.Load() || pet.petVisualData == null || pet.name == null || pet.name.Equals("")) { SceneManager.LoadScene("Creation"); } else { pet.startAppCount++; pet.Save(false); } }
public bool Load() { if (File.Exists(Application.persistentDataPath + "/AugotchiSave.gd")) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Application.persistentDataPath + "/AugotchiSave.gd", FileMode.Open); PetGlobal pg = (PetGlobal)bf.Deserialize(file); hunger = pg.hunger; happiness = pg.happiness; health = pg.health; candy = pg.candy; food = pg.food; vegetables = pg.vegetables; currency = pg.currency; buildingMaterials = pg.buildingMaterials; saveTimeStamp = pg.saveTimeStamp; lastPettingTimeStamp = pg.lastPettingTimeStamp; markerSet = pg.markerSet; petVisualData = pg.petVisualData; petUnlocksData = pg.petUnlocksData; if (petUnlocksData.unlockedHats.Length < PetUnlocksData.hatCounts.Length) { int[] expandedArray = new int[PetUnlocksData.hatCounts.Length]; for (int i = 0; i < petUnlocksData.unlockedHats.Length; i++) { expandedArray[i] = petUnlocksData.unlockedHats[i]; } petUnlocksData.unlockedHats = expandedArray; } if (petUnlocksData.unlockedFaces.Length < PetUnlocksData.faceCounts.Length) { int[] expandedArray = new int[PetUnlocksData.faceCounts.Length]; for (int i = 0; i < petUnlocksData.unlockedFaces.Length; i++) { expandedArray[i] = petUnlocksData.unlockedFaces[i]; } petUnlocksData.unlockedFaces = expandedArray; } isDead = pg.isDead; reviveProgress = pg.reviveProgress; xp = pg.xp; level = pg.level; if (level == 0) { level = 1; } markersCurrency = pg.markersCurrency; markersFood = pg.markersFood; markersCrate = pg.markersCrate; markersRevive = pg.markersRevive; petDeathCount = pg.petDeathCount; petRevivalCount = pg.petRevivalCount; pettingCount = pg.pettingCount; candyFed = pg.candyFed; foodFed = pg.foodFed; vegetableFed = pg.vegetableFed; startAppCount = pg.startAppCount; stepCounter = pg.stepCounter; activeTicks = pg.activeTicks; inactiveTicks = pg.inactiveTicks; currentAliveTicks = pg.currentAliveTicks; longestAliveTicks = pg.longestAliveTicks; name = pg.name; strength = pg.strength; intelligence = pg.intelligence; agility = pg.agility; isDungeoneering = pg.isDungeoneering; activeDungeon = pg.activeDungeon; dungeonStartTimestamp = pg.dungeonStartTimestamp; if (pg.inventory != null) { this.inventory = new Inventory( pg.inventory.seedCounts == null ? new int[0] : pg.inventory.seedCounts, pg.inventory.produceCounts == null ? new int[0] : pg.inventory.produceCounts, pg.inventory.gardenDecorCounts == null ? new int[0] : pg.inventory.gardenDecorCounts, pg.inventory.uniqueCounts == null ? new int[0] : pg.inventory.uniqueCounts ); } else { this.inventory = new Inventory(); } this.questLog = pg.questLog == null ? new List <Quest>() : pg.questLog; foreach (Quest q in questLog) { q.initQuestListener(); } this.Base = pg.Base; if (pg.Base.baseGardenDecors == null) { this.Base.baseGardenDecors = new List <BaseGardenDecor>(); } file.Close(); TestPetToDatabase.postData = true; degenerateTick(); return(true); } else { hunger = 75; health = 75; happiness = 75; level = 1; Save(false); return(false); } }
public void SaveVisuals(PetVisualData petVisualData) { if (File.Exists(Application.persistentDataPath + "/AugotchiSave.gd")) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Application.persistentDataPath + "/AugotchiSave.gd", FileMode.Open); PetGlobal pg = (PetGlobal)bf.Deserialize(file); hunger = pg.hunger; happiness = pg.happiness; health = pg.health; candy = pg.candy; food = pg.food; vegetables = pg.vegetables; currency = pg.currency; buildingMaterials = pg.buildingMaterials; saveTimeStamp = pg.saveTimeStamp; lastPettingTimeStamp = pg.lastPettingTimeStamp; markerSet = pg.markerSet; petUnlocksData = pg.petUnlocksData; isDead = pg.isDead; reviveProgress = pg.reviveProgress; xp = pg.xp; level = pg.level; markersCurrency = pg.markersCurrency; markersFood = pg.markersFood; markersCrate = pg.markersCrate; markersRevive = pg.markersRevive; petDeathCount = pg.petDeathCount; petRevivalCount = pg.petRevivalCount; pettingCount = pg.pettingCount; candyFed = pg.candyFed; foodFed = pg.foodFed; vegetableFed = pg.vegetableFed; startAppCount = pg.startAppCount; stepCounter = pg.stepCounter; activeTicks = pg.activeTicks; inactiveTicks = pg.inactiveTicks; currentAliveTicks = pg.currentAliveTicks; longestAliveTicks = pg.longestAliveTicks; name = pg.name; file.Close(); this.petVisualData = petVisualData; Save(true); } else { hunger = 75; happiness = 50; health = 50; level = 1; this.petVisualData = petVisualData; Save(false); } }