Пример #1
0
 /// <summary>
 ///  creates a new tank for a player
 /// </summary>
 /// <param name="player">The owner of new tank</param>
 /// <param name="tankX">Starting X coordinate of new tank</param>
 /// <param name="tankY">Starting Y coordinate of new tank</param>
 /// <param name="game">The current battle</param>
 public GameplayTank(GenericPlayer player, int tankX, int tankY, Battle game)
 {
     //sets up the default values of tank via passed information in constructor
     tanksPlayer = player;
     tankPosX    = tankX;
     tankPosY    = tankY;
     tankInGame  = game;
     //find the tank model via player
     tanksModel = tanksPlayer.GetTank();
     //gets the health of said model
     tankDurbility = tanksModel.GetTankHealth();
     //set the default values for angle , power and weapon
     currentAngle  = 0f;
     currentPower  = 25;
     currentWeapon = 0;
     //draw tank on feild of battle and save bitmap to class
     tankBmp = tanksModel.CreateTankBMP(tanksPlayer.PlayerColour(), currentAngle);
 }
Пример #2
0
 /// <summary>
 ///  sets the current aiming angle
 /// </summary>
 /// <param name="angle">new aiming angle</param>
 public void Aim(float angle)
 {
     currentAngle = angle;
     tanksModel.DisplayTank(currentAngle);
     tankBmp = tanksModel.CreateTankBMP(tanksPlayer.PlayerColour(), currentAngle);
 }