Esempio n. 1
0
        /// <summary>
        /// Handles firing the specified weapon from the tank.
        ///
        /// Author John Santias and Hoang Nguyen October 2017
        /// </summary>
        /// <param name="weapon">int based on string returned from Weaponlist()</param>
        /// <param name="playerTank">Controlledtank associated with this</param>
        /// <param name="currentGame">the current Game being played</param>
        public override void FireWeapon(int weapon, ControlledTank playerTank, Gameplay currentGame)
        {
            float    centerPosX = (float)playerTank.GetX() + (WIDTH / 2), centerPosY = (float)playerTank.GetYPos() + (HEIGHT / 2);
            Opponent op    = playerTank.GetPlayerNumber();
            Blast    blast = new Blast(100, 4, 4);
            Shell    shell = new Shell(centerPosX, centerPosY, playerTank.GetAim(), playerTank.GetCurrentPower(), 0.01f, blast, op);

            currentGame.AddWeaponEffect(shell);
        }
Esempio n. 2
0
        /// <summary>
        /// This method is used to handle firing the specified weapon from the tank playerTank.
        /// Author Greyden Scott & Sean O'Connell October 2017
        /// Written, edited and tested by both team members
        /// </summary>
        /// <param name="weapon">The index of the weapon selected</param>
        /// <param name="playerTank">the player tank</param>
        /// <param name="currentGame">the current GamePlay</param>
        /// <returns> Returns the starting durability of this type of tank </returns>
        public override void ActivateWeapon(int weapon, BattleTank playerTank, Gameplay currentGame)
        {
            float gravity = 0;
            float x_pos   = (float)playerTank.GetX() + (TankModel.WIDTH / 2);
            float y_pos   = (float)playerTank.Y() + (TankModel.HEIGHT / 2);

            Opponent player       = playerTank.GetPlayer();
            int      explosionDmg = 0;
            int      explosionRad = 0;
            int      explosionDes = 0;

            gravity      = 0.01f;
            explosionDmg = 100;
            explosionRad = 4;
            explosionDes = 4;

            Blast blast = new Blast(explosionDmg, explosionRad, explosionDes);
            Shell shell = new Shell(x_pos, y_pos, playerTank.GetTankAngle(), playerTank.GetCurrentPower(), gravity, blast, player);

            currentGame.AddWeaponEffect(shell);
        }