Example #1
0
 private void AssignReferences()
 {
     ButtonPistol         = this.GetGraphicalUiElementByName("ButtonPistol") as Pirates.GumRuntimes.ButtonRuntime;
     ButtonShotgun        = this.GetGraphicalUiElementByName("ButtonShotgun") as Pirates.GumRuntimes.ButtonRuntime;
     InventoryBarInstance = this.GetGraphicalUiElementByName("InventoryBarInstance") as Pirates.GumRuntimes.InventoryForms.InventoryBarRuntime;
     InventoryGui         = this.GetGraphicalUiElementByName("InventoryGui") as Pirates.GumRuntimes.InventoryForms.InventoryGuiRuntime;
 }
Example #2
0
        public override void Initialize(bool addToManagers)
        {
            LoadStaticContent(ContentManagerName);
            PlayerBoat          = new Pirates.Entities.Boat(ContentManagerName, false);
            PlayerBoat.Name     = "PlayerBoat";
            BoatList            = new FlatRedBall.Math.PositionedObjectList <Pirates.Entities.Boat>();
            BoatList.Name       = "BoatList";
            DockList            = new FlatRedBall.Math.PositionedObjectList <Pirates.Entities.Dock>();
            DockList.Name       = "DockList";
            PlayerInstance      = new Pirates.Entities.Player(ContentManagerName, false);
            PlayerInstance.Name = "PlayerInstance";
            UIBoatLayer         = new FlatRedBall.Graphics.Layer();
            UIBoatLayer.Name    = "UIBoatLayer";
            SandCollision       = new FlatRedBall.TileCollisions.TileShapeCollection();
            SandCollision.Name  = "SandCollision";
            WaterCollision      = new FlatRedBall.TileCollisions.TileShapeCollection();
            WaterCollision.Name = "WaterCollision";
            DirtCollision       = new FlatRedBall.TileCollisions.TileShapeCollection();
            DirtCollision.Name  = "DirtCollision";
            HulkCollision       = new FlatRedBall.TileCollisions.TileShapeCollection();
            HulkCollision.Name  = "HulkCollision";
            RockCollision       = new FlatRedBall.TileCollisions.TileShapeCollection();
            RockCollision.Name  = "RockCollision";
            CannonballList      = new FlatRedBall.Math.PositionedObjectList <Pirates.Entities.Cannonball>();
            CannonballList.Name = "CannonballList";
            SpeedMeter          = new Pirates.Entities.UI.SpeedMeter(ContentManagerName, false);
            SpeedMeter.Name     = "SpeedMeter";
            ExplosionList       = new FlatRedBall.Math.PositionedObjectList <Pirates.Entities.Animations.Explosion>();
            ExplosionList.Name  = "ExplosionList";
            ButtonPistol        = GameScreenGum.GetGraphicalUiElementByName("ButtonPistol") as Pirates.GumRuntimes.ButtonRuntime;
            ButtonShotgun       = GameScreenGum.GetGraphicalUiElementByName("ButtonShotgun") as Pirates.GumRuntimes.ButtonRuntime;
            BulletList          = new FlatRedBall.Math.PositionedObjectList <Pirates.Entities.Bullet>();
            BulletList.Name     = "BulletList";
            EnemyList           = new FlatRedBall.Math.PositionedObjectList <Pirates.Entities.Skeleton>();
            EnemyList.Name      = "EnemyList";
            InventoryBar        = GameScreenGum.GetGraphicalUiElementByName("InventoryBarInstance") as Pirates.GumRuntimes.InventoryForms.InventoryBarRuntime;
            InventoryGui        = GameScreenGum.GetGraphicalUiElementByName("InventoryGui") as Pirates.GumRuntimes.InventoryForms.InventoryGuiRuntime;
            // normally we wait to set variables until after the object is created, but in this case if the
            // TileShapeCollection doesn't have its Visible set before creating the tiles, it can result in
            // really bad performance issues, as shapes will be made visible, then invisible. Really bad perf!
            SandCollision.Visible = false;
            FlatRedBall.TileCollisions.TileShapeCollectionLayeredTileMapExtensions.AddCollisionFromTilesWithType(SandCollision, Terrain, "Sand");
            // normally we wait to set variables until after the object is created, but in this case if the
            // TileShapeCollection doesn't have its Visible set before creating the tiles, it can result in
            // really bad performance issues, as shapes will be made visible, then invisible. Really bad perf!
            WaterCollision.Visible = false;
            FlatRedBall.TileCollisions.TileShapeCollectionLayeredTileMapExtensions.AddCollisionFromTilesWithType(WaterCollision, Terrain, "Water");
            // normally we wait to set variables until after the object is created, but in this case if the
            // TileShapeCollection doesn't have its Visible set before creating the tiles, it can result in
            // really bad performance issues, as shapes will be made visible, then invisible. Really bad perf!
            DirtCollision.Visible = false;
            FlatRedBall.TileCollisions.TileShapeCollectionLayeredTileMapExtensions.AddCollisionFromTilesWithType(DirtCollision, Terrain, "Dirt");
            // normally we wait to set variables until after the object is created, but in this case if the
            // TileShapeCollection doesn't have its Visible set before creating the tiles, it can result in
            // really bad performance issues, as shapes will be made visible, then invisible. Really bad perf!
            HulkCollision.Visible = false;
            FlatRedBall.TileCollisions.TileShapeCollectionLayeredTileMapExtensions.AddCollisionFromTilesWithType(HulkCollision, Terrain, "Hulk");
            // normally we wait to set variables until after the object is created, but in this case if the
            // TileShapeCollection doesn't have its Visible set before creating the tiles, it can result in
            // really bad performance issues, as shapes will be made visible, then invisible. Really bad perf!
            RockCollision.Visible = false;
            FlatRedBall.TileCollisions.TileShapeCollectionLayeredTileMapExtensions.AddCollisionFromTilesWithType(RockCollision, Terrain, "Rock");


            PostInitialize();
            base.Initialize(addToManagers);
            if (addToManagers)
            {
                AddToManagers();
            }
        }