/// <summary> /// This constructor stores player, tankX, tankY and game as private fields of GameplayTank. /// It then gets the Chassis by using the GenericPlayer's GetTank() method, /// then calls GetTankArmour() on it and stores this as the GameplayTank's current durability. /// This will go down as the tank takes damage. /// </summary> /// <param name="player">the player using the tank</param> /// <param name="tankX">coordinate</param> /// <param name="tankY">coordinate</param> /// <param name="game">the battle the tank is apart of</param> public GameplayTank(GenericPlayer player, int tankX, int tankY, Battle game) { this.player = player; this.tankX = tankX; this.tankY = tankY; this.game = game; durability = player.GetTank().GetTankArmour(); angle = 0; power = 25; currentWeapon = 0; tankBitmap = player.GetTank().CreateTankBMP(player.GetColour(), angle); }
/// <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); }
/// <returns>Returns the chassis type of the tank</returns> public Chassis GetTank() { return(player.GetTank()); }
/// <summary> /// returns the model assoicated with the tank /// </summary> /// <returns></returns> public TankModel GetTank() { return(tanksPlayer.GetTank()); }