Ejemplo n.º 1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            _pauseBackground = new StaticSprite("UI/PauseScreen", 1, DrawLayers.Menu.Backgrounds);

            _gameoverWinScreen      = new StaticSprite("Screens/WinScreen", 1, DrawLayers.Menu.Backgrounds);
            _startMenuScreen        = new StaticSprite("Screens/StartMenuScreen", 1, DrawLayers.Menu.Backgrounds);
            _startMenuScreenOverlay = new StaticSprite("Screens/StartMenuScreenOverlay", 1, DrawLayers.Menu.Backgrounds);
            //_1pxBlack = new StaticSprite("1pxBlack", 1, DrawLayers.MenuBackgrounds);
        }
Ejemplo n.º 2
0
        public MapTile(Vector2 startingPosition, DoorDirections openDoors, bool visible)
            : base(startingPosition)
        {
            _openDoors = openDoors;

            _connectedDoors = new DoorDirections(false, false, false, false);

            _sprite = new StaticSprite(MapTileUtilities.appearanceStringFromDoorConfiguration(openDoors), TileSideLength, DrawLayers.GameElements.TileGround);

            _body          = new Body(Program.Objects.PhysicsWorld);
            _body.Position = startingPosition;
            _body.BodyType = BodyType.Kinematic;
            _body.UserData = this;

            MapTileUtilities.AttachFixtures(_body, _openDoors);

            _isVisible = visible;
        }
Ejemplo n.º 3
0
 internal void Initialize()
 {
     _retical      = new StaticSprite("UI/Retical", 1, DrawLayers.VeryTop.Mouse);
     _mouse        = new StaticSprite("UI/Mouse", 1, DrawLayers.VeryTop.Mouse);
     _mouseClicked = new StaticSprite("UI/Mouse_Clicked", 1, DrawLayers.VeryTop.Mouse);
 }
Ejemplo n.º 4
0
        internal void StartNewGame()
        {
            _tiles = Program.Objects.Map.Tiles;

            //Calculate the size of our interface
            int interfaceSideLength = Math.Min(Screen.Width, Screen.Height) - (2 * interfacePixelPadding);

            //Add 2 for the buttons on each end
            int gridSideIndexDimension = _tiles.GetLength(0) + 2;

            _tileSideLength = interfaceSideLength / (float)gridSideIndexDimension;

            StaticSprite tileSprite = _tiles[0, 0].ShiftTexture;

            _scalingFactor = _tileSideLength / tileSprite.CurrentTextureBounds.Width;

            //Create buttons

            //Length from centre to the very edge of the farthest button
            float longLength = interfaceSideLength / 2f;

            //Length to the edge of the map tiles
            float shortLength = longLength - _tileSideLength;

            float leftX        = Screen.Center.X - longLength;
            float topY         = Screen.Center.Y - longLength;
            float leftOfRightX = leftX + (gridSideIndexDimension - 1) * _tileSideLength;
            float topOfBottomY = topY + (gridSideIndexDimension - 1) * _tileSideLength;

            for (int i = 0; i < _tiles.GetLength(0); i++)
            {
                //Top buttons
                Rectangle buttonRect = new Rectangle((int)(leftX + _tileSideLength * (i + 1)), (int)topY, (int)_tileSideLength, (int)_tileSideLength);
                _buttons.Add(new ShiftButton(this, buttonRect, i, ShiftDirection.UP));

                //Bottom buttons
                buttonRect = new Rectangle((int)(leftX + _tileSideLength * (i + 1)), (int)topOfBottomY, (int)_tileSideLength, (int)_tileSideLength);
                _buttons.Add(new ShiftButton(this, buttonRect, i, ShiftDirection.DOWN));

                //Left buttons
                buttonRect = new Rectangle((int)leftX, (int)(topY + _tileSideLength + (_tileSideLength * i)), (int)_tileSideLength, (int)_tileSideLength);
                _buttons.Add(new ShiftButton(this, buttonRect, i, ShiftDirection.LEFT));

                //Right buttons
                buttonRect = new Rectangle((int)leftOfRightX, (int)(topY + _tileSideLength + (_tileSideLength * i)), (int)_tileSideLength, (int)_tileSideLength);
                _buttons.Add(new ShiftButton(this, buttonRect, i, ShiftDirection.RIGHT));
            }

            float halfLength = (_tiles.GetLength(0) / (float)2) * _tileSideLength;

            _topLeftTilePosition = new Vector2(Screen.Center.X - halfLength + 0.5f * _tileSideLength, Screen.Center.Y - halfLength + 0.5f * _tileSideLength);


            //Create the shift button
            Rectangle    shiftButtonRect = new Rectangle((int)(Screen.ScreenRect.Right - 300), 200, 250, 125);
            StaticSprite normalSprite    = new StaticSprite("Shifting/AddShiftButton", 1.0f, DrawLayers.Menu.Elements);
            StaticSprite pressedSprite   = new StaticSprite("Shifting/AddShiftButtonPressed", 1.0f, DrawLayers.Menu.Elements);

            _addShiftToQueueButton = new UIButton(shiftButtonRect, 0.0f, normalSprite, pressedSprite);
            _addShiftToQueueButton.setTarget(enqueueShift);
        }