コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Villager vi = new Villager();

            //      MessageBox.Show("-->"+vi.Talk());
            MessageBox.Show("vi-->" + vi.GetHP());

            Monster mon = new Monster();

            MessageBox.Show("mon-->" + mon.GetHP());

            vi.Injured(mon.Attack());
            MessageBox.Show("vi2-->" + vi.GetHP());
        }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            Villager vi  = new Villager();
            Monster  mon = new Monster();

            mon.Attack(vi);

            MessageBox.Show("Villager-->" + vi.GetHP());

            Monster mon2 = new Monster();

            mon.Attack(mon2);
            MessageBox.Show("Monster-->" + mon2.GetHP());
        }
コード例 #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            Villager vi  = new Villager();
            Monster  mon = new Monster();

            //2   vi.Injured(mon.Attack());

            ///2   int a = mon.Attack();
            ///2   a = 50;

            ///2   vi.Injured(a);

            mon.Attack(vi);


            MessageBox.Show("vi2-->" + vi.GetHP());
        }
コード例 #4
0
 //2   public int Attack()
 //2   {
 //2       return 10;
 //2  }
 public void Attack(Villager vi)
 {
     vi.Injured(10);
 }