Ejemplo n.º 1
0
 public Animal(Point position, camp camp, byte level,int index)
 {
     this.position = position;
     this.iniPosition = position;
     this.camp = camp;
     this.level = level;
     this.index = index;
     setPiecePosition(position);
 }
Ejemplo n.º 2
0
 void piecesRefresh()
 {
     for (int i = 0; i < 16; i++) {
         pieces[i].Visible = true;
         animals[i].MoveTo(animals[i].IniPosition);
     }
     for (int i = 0; i < 4; i++) {
         picForcast[i].Visible = false;
     }
     currentCamp = camp.red;
     for (int i = 1; i < 16; i += 2) {
         pieces[i-1].Enabled = true;
         pieces[i].Enabled = false;
     }
 }
Ejemplo n.º 3
0
        void picForcast_Click(object sender, EventArgs e)
        {
            foreach (Animal a in animals) {
                if (unFormat(((PictureBox)sender).Location) == a.Position) {
                    a.BeEaten();
                }
            }
            animals[pieceClick].MoveTo(unFormat(((PictureBox)sender).Location));

            for (int i = 0; i < 4; i++) {
                picForcast[i].Visible = false;
            }
            if (currentCamp == camp.red) {
                for (int i = 0; i < 16; i += 2) {
                    pieces[i].Enabled = false;
                    pieces[i + 1].Enabled = true;
                }
                currentCamp = camp.black;
            }
            else {
                for (int i = 1; i < 16; i += 2) {
                    pieces[i].Enabled = false;
                    pieces[i - 1].Enabled = true;
                }
                currentCamp = camp.red;
            }

            //The winning condition
            if (animals[pieceClick].Camp == camp.red && animals[pieceClick].Position == blackBase) {
                MessageBox.Show("Red Wins");
                piecesRefresh();
            }
            else if (animals[pieceClick].Camp == camp.black && animals[pieceClick].Position == redBase) {
                MessageBox.Show("black Wins");
                piecesRefresh();
            }
        }
Ejemplo n.º 4
0
 public Elephant(Point position, camp camp,int index)
     : base(position, camp, 8, index)
 {
 }
Ejemplo n.º 5
0
 public Wolf(Point position, camp camp,int index)
     : base(position, camp, 3,index)
 {
 }
Ejemplo n.º 6
0
 public Dog(Point position, camp camp,int index)
     : base(position, camp, 4,index)
 {
 }
Ejemplo n.º 7
0
 public Tiger(Point position, camp camp,int index)
     : base(position, camp, 6,index)
 {
 }
Ejemplo n.º 8
0
 public Mouse(Point position, camp camp,int index)
     : base(position, camp, 1,index)
 {
 }
Ejemplo n.º 9
0
 public Lion(Point position, camp camp,int index)
     : base(position, camp, 7, index)
 {
 }
Ejemplo n.º 10
0
 public Leopard(Point position, camp camp,int index)
     : base(position, camp, 5,index)
 {
 }
Ejemplo n.º 11
0
 public Cat(Point position, camp camp,int index)
     : base(position, camp, 2,index)
 {
 }