public void WakeUp() { pet.SetState(pet.GetAwakeState()); }
//----------------------LOAD AND SAVE---------------------------------------------------------------------- public void loadPet() { if (openFileDialog1.ShowDialog() == DialogResult.OK) { string name = openFileDialog1.FileName; BinaryReader binaryReader = new BinaryReader(File.Open(name, FileMode.Open)); if (Path.GetExtension(name) == ".dog") { dog = new Dog(); pet = dog; petPetButton.Text = "Pet Dog"; petPlayButton.Text = "Play with Dog"; petWaterButton.Text = "Give Dog Water"; feedPetButton.Text = "Feed Dog"; } if (Path.GetExtension(name) == ".cat") { cat = new Cat(); pet = cat; petPetButton.Text = "Pet Cat"; petPlayButton.Text = "Play with Cat"; petWaterButton.Text = "Give Cat Water"; feedPetButton.Text = "Feed Cat"; } if (Path.GetExtension(name) == ".cap") { capy = new CapyBara(); pet = capy; petPetButton.Text = "Pet Capybara"; petPlayButton.Text = "Play with Capybara"; petWaterButton.Text = "Give Capybara Water"; feedPetButton.Text = "Feed Capybara"; } if (Path.GetExtension(name) == ".brd") { bird = new Bird(); pet = bird; petPetButton.Text = "Pet Bird"; petPlayButton.Text = "Play with Bird"; petWaterButton.Text = "Give Bird Water"; feedPetButton.Text = "Feed Bird"; } InitializeProgressBars(); pet.InitializeFrames(); boredomMeter.Maximum = pet.Max_Boredom; hungerMeter.Maximum = pet.Max_Hunger; thirstMeter.Maximum = pet.Max_Thirst; affectionMeter.Maximum = pet.Max_Affection; waterAmountBar.Maximum = pet.Max_Water; foodAmountBar.Maximum = pet.Max_Food; energyBar.Maximum = pet.Max_Energy; AttachPetEvents(); petPictureBox.Image = pet.currentImage; pet.CurrentFood = binaryReader.ReadInt32(); pet.PetAffection = binaryReader.ReadInt32(); pet.PetThirst = binaryReader.ReadInt32(); pet.CurrentWater = binaryReader.ReadInt32(); pet.PetHunger = binaryReader.ReadInt32(); pet.CurrentEnergy = binaryReader.ReadInt32(); pet.PetBoredom = binaryReader.ReadInt32(); pet.SetState(pet.GetAwakeState()); this.TopMost = true; binaryReader.Dispose(); } }