public EditorScreen(ScreenManager manager) : base(manager, "Editor") { // Create crosshair _Crosshair = new Crosshair(this); Tile.TileWidth = 24.0f; Tile.TileHeight = 24.0f; // Setup tiles _TileGrid = new Tile[TileRows, TileCols]; for (row = 0; row < TileRows; row++) { for (col = 0; col < TileCols; col++) { _TileGrid[row, col] = Tile.TileGen[0](this, new Vector3(col * Tile.TileWidth, row * Tile.TileHeight, 0)); } } // Setup screen behavior _Depth = 0.7f; _FadeInTime = 0.0f; _FadeOutTime = 0.0f; _Message = "LeftClick: Place Primary Tile\nRightClick: Place Secondary Tile\nMouseScroll: Zoom, W S A D: Move\nF: Toggle Texture Browser"; _MessageFont = Application.AppReference.Content.Load <SpriteFont>("Fonts/DefaultFont"); _MessageColour = Color.White; _DynamicLighting = false; _Crosshair.Hide = true; // Setup ports _ViewPort.TargetLocation = new Vector3(TileCols * Tile.TileWidth, TileRows * Tile.TileHeight, 0); _LoadPort = new LoadPort(this, Vector2.Zero, _ViewPort.Size * 1.20f, _ViewPort.Size.Y * 0.1f); }
public WorldScreen(ScreenManager manager, String worldMap) : base(manager, "World") { // Load world _WorldMap = worldMap; FileStream fs = File.OpenRead(_WorldMap); BinaryReader bin = new BinaryReader(fs); _TileRows = bin.ReadInt32(); _TileCols = bin.ReadInt32(); Tile.TileWidth = bin.ReadSingle(); Tile.TileHeight = bin.ReadSingle(); for (int row = 0; row < TileRows; row++) { for (int col = 0; col < TileCols; col++) { int index = bin.ReadInt32(); Tile.TileGen[index](this, new Vector3(col * Tile.TileWidth, row * Tile.TileHeight, 0)); } } bin.Close(); fs.Close(); // Create player PlayerMarine = new Marine(this, new Vector3(TileCols * Tile.TileWidth / 2, TileRows * Tile.TileHeight / 2, 0)); //PlayerMarine.DrawO // Create crosshair _Crosshair = new Crosshair(this); _Crosshair.Hide = false; // Create aliens for (int i = 0; i < NumDrones; i++) { int index = Application.AppReference.Random.Next(SpawnLocations.Length); new Drone(this, SpawnLocations[index], _PlayerEntity); } // Setup screen behavior _Depth = 0.9f; _FadeInTime = 0.0f; _FadeOutTime = 0.0f; _MessageFont = Application.AppReference.Content.Load <SpriteFont>("Fonts/DefaultFont"); _MessageColour = Color.White; _DynamicLighting = true; // Create loadport LoadPort = new LoadPort(this, Vector2.Zero, new Vector2(1050, 750), 100f); // Play music MediaPlayer.Play(Application.AppReference.Content.Load <Song>("Audio/Music/GameMusic01")); // Start dynamic lighting thread StartBackgroundThread(); }