public FuelStationFuelBar(FuelStation fuelStation)
 {
     this.fuelStation = fuelStation;
     border           = Texture2D.GetInstance("data/fuelbar/fuelStationFuelBarBorder.png");
     fuel             = Texture2D.GetInstance("data/fuelbar/fuelStationFuelBarFuel.png");
     background       = Texture2D.GetInstance("data/fuelbar/fuelStationFuelBarBackground.png");
 }
예제 #2
0
        private void InitializeSceneObjects(Vector2Int playerSpawnLocation)
        {
            drillProgressIndicator = new DrillProgressIndicator {
                Alpha = 0
            };
            fuelStation  = new FuelStation("data/fuel_station_above_ground.png", 3, Settings.Instance.World.TopOffset - 1, Settings.Instance.FirstFuelStationFuel, new Vector2(0, 2 * Globals.TILE_SIZE - 8));
            fuelStation2 = new FuelStation("data/fuel_station_below_ground.png", 5, 255, Settings.Instance.SecondFuelStationFuel, new Vector2(3.9f * Globals.TILE_SIZE, 2 * Globals.TILE_SIZE - 8));
            fuelStation.Move(0, 2 * Globals.TILE_SIZE);
            fuelStation2.Move(5 * Globals.TILE_SIZE, 252 * Globals.TILE_SIZE);

            player = new Player();
            player.SetXY(playerSpawnLocation.x * Globals.TILE_SIZE, playerSpawnLocation.y * Globals.TILE_SIZE);

            camera = new Camera(0, 0, Globals.WIDTH, Globals.HEIGHT)
            {
                x = (int)(Globals.WIDTH / 2f)
            };                                                                                         // weird camera behaviour fix

            fuelBar = new FuelBar();
            fuelBar.Move(-Globals.WIDTH / 2f, 0f); // weird camera behaviour fix
            HUD = new Canvas(Globals.WIDTH, Globals.HEIGHT, false);
            HUD.Move(0, -Globals.HEIGHT / 2f);
            HUD.Move(-Globals.WIDTH / 2f, 0f); // weird camera behaviour fix

            visibility    = new VisibilitySystem(player);
            topBackground = Texture2D.GetInstance("data/background_above_ground_2ver3.png", true);

            /*topBackground = new Sprite("data/background_test.jpg", true, false);
             * topBackground.Move(0, -2*Globals.TILE_SIZE);
             * topBackground.SetScaleXY(0.711458333f);*/

            camera.AddChild(fuelBar);
            camera.LateAddChild(HUD);

            AddChild(fuelStation);
            AddChild(fuelStation2);
            AddChild(visibility);
            AddChild(player);
            AddChild(drillProgressIndicator);
            AddChild(camera);
        }