示例#1
0
文件: Shell.cs 项目: KALVS/CAB201
        public Shell(float x, float y, float angle, float power, float gravity, Shrapnel explosion, Opponent player)
        {
            Sx         = x;
            Sy         = y;
            Splayer    = player;
            Sexplosion = explosion;
            Sgravity   = gravity;
            float angleRadians = (90 - angle) * (float)Math.PI / 180;
            float magnitude    = power / 50;

            SxVelocity = (float)Math.Cos(angleRadians) * magnitude;
            SyVelocity = (float)Math.Sin(angleRadians) * -magnitude;
        }
示例#2
0
        public Projectile(float x, float y, float angle, float power, float gravity, Shrapnel explosion, TankController player)
        {
            // Initialising the projectile properties
            xPos       = x;
            yPos       = y;
            graV       = gravity;
            exP        = explosion;
            tankPlayer = player;

            float angleRadians = (90 - angle) * (float)Math.PI / 180;
            float magnitude    = power / 50;

            xVel = (float)Math.Cos(angleRadians) * magnitude;
            yVel = (float)Math.Sin(angleRadians) * -magnitude;
        }
示例#3
0
        public Bullet(float x, float y, float angle, float power, float gravity, Shrapnel explosion, TankModel player)
        {
            X          = x;
            Y          = y;
            angles     = angle;
            powers     = power;
            gravitys   = gravity;
            explosions = explosion;
            players    = player;
            float angleRadians = (90 - angle) * (float)Math.PI / 180;
            float magnitude    = power / 50;

            dx = (float)Math.Cos(angleRadians) * magnitude;
            dy = (float)Math.Sin(angleRadians) * (-magnitude);
        }
示例#4
0
文件: Chassis.cs 项目: KALVS/CAB201
        public override void WeaponLaunch(int weapon, PlayerTank playerTank, Gameplay currentGame)
        {
            Debug.WriteLine("Chassis WeaponLaunch Start");
            //Alex Holm N9918205
            float x = (playerTank.XPos());
            float y = (playerTank.GetY());

            x += (Chassis.WIDTH) / 2;
            y += (Chassis.HEIGHT) / 2;
            Opponent player    = playerTank.GetPlayer();
            Shrapnel shrap     = new Shrapnel(100, 4, 4);
            Shell    Std_shell = new Shell(x, y, playerTank.GetAngle(), playerTank.GetPower(), 0.01f, shrap, player);

            currentGame.AddEffect(Std_shell);
            Debug.WriteLine("Chassis WeaponLaunch Complete");
        }
示例#5
0
        public override void FireWeapon(int weapon, PlayerTank playerTank, GameController currentGame)
        {
            // Firing the specified weapon from playerTank
            float xPos = playerTank.GetX();
            float yPos = playerTank.GetYPos();

            xPos += Chassis.WIDTH / 2;
            yPos += Chassis.HEIGHT / 2;

            TankController tankContr = playerTank.GetPlayerById();

            Shrapnel newShrapnel = new Shrapnel(100, 4, 4);

            Projectile newProj = new Projectile(xPos, yPos, playerTank.GetPlayerAngle(), playerTank.GetTankPower(), 0.01f, newShrapnel, tankContr);

            currentGame.AddEffect(newProj);
        }