Example #1
0
	void Start() {
		screenHeight = Screen.height;
		screenWidth = Screen.width;
		
		buttonHeight = screenHeight * 0.15f;
		buttonWidth = screenWidth * 0.4f;
		menuFunction = mainMenu;

		Utilities.FindGameStateObject(out gameStateObject, out gameState);
		// show continue button only if there are lives left and the last level wasn't the menu
		showContinueButton = gameState != null && gameState.LivesLeft > 0 && gameState.LastLevel != 0;
	}
Example #2
0
    void Start()
    {
        screenHeight = Screen.height;
        screenWidth  = Screen.width;

        buttonHeight = screenHeight * 0.15f;
        buttonWidth  = screenWidth * 0.4f;
        menuFunction = mainMenu;

        Utilities.FindGameStateObject(out gameStateObject, out gameState);
        // show continue button only if there are lives left and the last level wasn't the menu
        showContinueButton = gameState != null && gameState.LivesLeft > 0 && gameState.LastLevel != 0;
    }
Example #3
0
        /// <inheritdoc />
        /// <summary>
        ///     Создаёт экземпляр окна, по переданной игре
        /// </summary>
        /// <param name="game"></param>
        public Window(IGame game)
        {
            _game = game;

            Width  = 1000;
            Height = 500;

            CoordSheet = new CoordinateSheet(Width, Height);

            pict   = new Bitmap(Width, Height);
            drawer = Graphics.FromImage(pict);
            drawer.InterpolationMode = InterpolationMode.NearestNeighbor;
            drawer.PixelOffsetMode   = PixelOffsetMode.Half;

            screen = new PictureBox
            {
                Width  = Width,
                Height = Height,
                Left   = 0,
                Top    = 0
            };
            Controls.Add(screen);

            KeyDown          += OnKeyDown;
            KeyUp            += OnKeyUp;
            SizeChanged      += OnSizeChanged;
            screen.MouseMove += OnMouseMove;

            pause          = new MenuPause(this);
            ChangeControls = new MenuChangeControls(this);
            gameOver       = new MenuGameOver(this);

            _gameoverTool.LocationChanged += (o, e) => RealGameOver();
            Controls.Add(_gameoverTool);

            _timer          = new Timer(20);
            _timer.Elapsed += (o, e) =>
            {
                foreach (var texture in _textures)
                {
                    texture.Value.Tick(20 * 0.001);
                }
            };
            _timer.Elapsed += Draw;
            _timer.Start();

            MouseWheel += (o, e) => ChangeScale(e.Delta < 0 ? 0.9 : 10.0 / 9);
        }