public Ship(int boat, int size, Point Location)
{
this.nShip = boat;
this._size = size;
/*-----------------------------------------*
*| NUMBERS | ITEMS | SIZE |*
*-----------------------------------------*
*| 0 | MINE | 1*1 |*
*| 1 | SUBMARINE | 1*3 |*
*| 2 | DESTROYER | 1*4 |*
*| 3 | HELICOPTER-CARIER | 2*2 |*
*| 4 | AIRCRAFT-CARIER | 2*3 |*
*-----------------------------------------*/
switch (this.ships[this.nShip])
{
// mine
case 0:
this.X = Location.X * 2;
this.Y = Location.Y + this._size * YPOSINIT;
this.WidthCase = 1;
this.HeightCase = 1;
this.shipColor = Color.DarkSeaGreen;
break;
// submarine
case 1:
this.X = this._size * 4;
this.Y = this._size * YPOSINIT;
this.WidthCase = 1;
this.HeightCase = 3;
this.shipColor = Color.Aquamarine;
break;
// destroyer
case 2:
this.X = this._size * 6;
this.Y = this._size * YPOSINIT;
this.WidthCase = 1;
this.HeightCase = 4;
this.shipColor = Color.Gray;
break;
// helicopter-carier
case 3:
this.X = this._size * 8;
this.Y = this._size * YPOSINIT;
this.WidthCase = 2;
this.HeightCase = 2;
this.shipColor = Color.Yellow;
break;
// aircraft-carier
case 4:
this.X = this._size * 11;
this.Y = this._size * YPOSINIT;
this.WidthCase = 2;
this.HeightCase = 3;
this.shipColor = Color.Red;
break;
}
// create the boat
for (int i = 0; i < this.WidthCase; i++)
{
for (int j = 0; j < this.HeightCase; j++)
{
this.shipSize.Add(new casePlatform(this.X + (this._size * i), this.Y + (this._size * j), this._size, this.shipColor));
}
}
}
#endregion