public frmManager(Pet userPet)
 {
     InitializeComponent();
     lblNameDisplay.Text = userPet.getName();
     lblHealthDisplay.Text = Convert.ToString(userPet.getStats().getHealth()) + "/" +
         Convert.ToString(userPet.getStats().getMaxHealth());
     lblAttackDisplay.Text = Convert.ToString(userPet.getStats().getAttack());
     lblDefenseDisplay.Text = Convert.ToString(userPet.getStats().getDefense());
 }
示例#2
0
        /*Creates a new instance of the Pet class for the user.
        *Takes input from the text boxes on the form to intialize the pet stats
        */
        private void btnCreate_Click(object sender, EventArgs e)
        {
            //Store input
            string petName = txtNameInput.Text;
            int petHealth = int.Parse(txtHealthInput.Text);
            int petAttack = int.Parse(txtAttackInput.Text);
            int petDefense = int.Parse(txtDefenseInput.Text);

            //Create instance of a pet using user input
            Pet userPet = new Pet(petName, petHealth, petAttack, petDefense);

            //Show the Manager form to the user with their pet information
            frmManager petMan = new frmManager(userPet);
            Hide();
            petMan.Show();
        }