示例#1
0
        public override void Initialise(Map map, Microsoft.Xna.Framework.Content.ContentManager Content, GraphicsDeviceManager graphics, Vector2 startPosition, List <Vector2> course)
        {
            Alive                 = false;
            Active                = false;
            bulletFireRate        = 200f;
            bulletElapsedTime     = 500f;
            bullets               = new Queue <Bullet>();
            this.Content          = Content;
            this.Course           = course;
            this.BoatSprite       = Content.Load <Texture2D>("ship_medium_body");
            this.GunASprite       = Content.Load <Texture2D>("ship_big_gun");
            this.HealthBar        = Content.Load <Texture2D>("Health_Bar");
            this.CannonFire       = Content.Load <SoundEffect>("Cannon+5");
            this.Crash            = Content.Load <SoundEffect>("Crash");
            GunASpriteDestroyed   = Content.Load <Texture2D>("ship_big_gun_destroyed");
            this.BoundingDot      = Content.Load <Texture2D>("Ball_White");
            this.BoundingDotScale = 0.01f;
            CrashVolume           = 0.2f;
            gunARotationAngle     = 0f;
            MinGunRange           = 100f;
            MaxGunRange           = 300f;
            GunRangeSpeed         = 10f;
            GunRange              = MinGunRange;
            DestructionRange      = 40f;
            Destruction           = 0.1f;
            this.map              = map;
            animation             = new BoatMovementAnimation();
            mapPosition           = startPosition;
            gunAOffset            = 10f;
            gunAMapPosition       = new Vector2(mapPosition.X, mapPosition.Y - gunAOffset);
            gunAAnimatedPosition  = new Vector2(map.PlayerAnimatedPosition.X, map.PlayerAnimatedPosition.Y - gunAOffset);
            Speed                 = 0;     //Sets players initial speed
            boatRotationSpeed     = 1000f; //Increase to slow ship rotation speed
            gunARotationSpeed     = 500f;  //Increase to slow GunA rotation speed
            hitPoints             = 1f;
            explosionCount        = 0;
            explosionScale        = .4f;

            animation.Initialise(Content.Load <Texture2D>("water_ripple_medium_000"),
                                 Content.Load <Texture2D>("water_ripple_medium_001"),
                                 Content.Load <Texture2D>("water_ripple_medium_002"),
                                 Content.Load <Texture2D>("water_ripple_medium_003"),
                                 Content.Load <Texture2D>("water_ripple_medium_004"), graphics);

            DestroyedBoatSpriteA = Content.Load <Texture2D>("ship_medium_body_destroyed");
            DestroyedBoatSpriteB = Content.Load <Texture2D>("ship_medium_body_b_destroyed");
            explosion            = new Texture2D[12];
            for (int num = 0; num < explosion.Length; num++)
            {
                explosion[num] = Content.Load <Texture2D>("Explosion_" + num.ToString());
            }

            BBHeight = BoatSprite.Height / 2.2f;
            BBWidth  = BoatSprite.Width / 3.2f;
            UpdateBoundingBox();
        }
示例#2
0
        public override void Initialise(Map map, Microsoft.Xna.Framework.Content.ContentManager Content, GraphicsDeviceManager graphics, Vector2 startPosition, List <Vector2> course)
        {
            this.Content          = Content;
            Active                = false;
            Alive                 = false;
            explosionCount        = 0;
            explosionScale        = .4f;
            this.Course           = course;
            NextPosition          = startPosition;
            this.BoatSprite       = Content.Load <Texture2D>("ship_medium_body");
            this.HealthBar        = Content.Load <Texture2D>("Health_Bar");
            DestroyedBoatSpriteA  = Content.Load <Texture2D>("ship_medium_body_destroyed");
            DestroyedBoatSpriteB  = Content.Load <Texture2D>("ship_medium_body_b_destroyed");
            this.GunASprite       = Content.Load <Texture2D>("ship_big_gun");
            GunASpriteDestroyed   = Content.Load <Texture2D>("ship_big_gun_destroyed");
            this.BoundingDot      = Content.Load <Texture2D>("Ball_White");
            this.BoundingDotScale = 0.01f;
            gunAOffset            = 10f;
            gunAMapPosition       = new Vector2(mapPosition.X, mapPosition.Y - gunAOffset);
            gunARotationSpeed     = 500f; //Increase to slow GunA rotation speed
            bullets               = new Queue <Bullet>();
            bulletFireRate        = 200f;
            bulletElapsedTime     = 0f;
            explosion             = new Texture2D[12];
            for (int num = 0; num < explosion.Length; num++)
            {
                explosion[num] = Content.Load <Texture2D>("Explosion_" + num.ToString());
            }


            this.map          = map;
            animation         = new BoatMovementAnimation();
            mapPosition       = startPosition;
            Speed             = 1;    //Sets players initial speed
            boatRotationSpeed = 800f; //Increase to slow ship rotation speed
            hitPoints         = 1f;

            animation.Initialise(Content.Load <Texture2D>("water_ripple_medium_000"),
                                 Content.Load <Texture2D>("water_ripple_medium_001"),
                                 Content.Load <Texture2D>("water_ripple_medium_002"),
                                 Content.Load <Texture2D>("water_ripple_medium_003"),
                                 Content.Load <Texture2D>("water_ripple_medium_004"), graphics);
            //Keeps map position within the limits of the screen
            //mapWidthRatio = graphics.PreferredBackBufferWidth / (Math.Abs(map.LeftBoundary) + Math.Abs(map.RightBoundary));
            //mapHeightRatio = graphics.PreferredBackBufferHeight / (Math.Abs(map.TopBoundary) + Math.Abs(map.BottomBoundary));

            BBHeight = BoatSprite.Height / 2.2f;
            BBWidth  = BoatSprite.Width / 3.2f;
            UpdateBoundingBox();
        }