Esempio n. 1
0
 /// <summary>
 /// Get the camera from the GameplayScreen
 /// </summary>
 public void GetCamera(Camera2D cameraBeingUsed)
 {
     _cam = cameraBeingUsed;
 }
        /// <summary>
        /// Multiplayer Constructor
        /// </summary>
        /// <param name="players">Dictionary of players</param>
        /// <param name="client">NetClient of the player</param>
        public GameplayScreen(Dictionary<long, string> players, NetClient client)
        {
            TransitionOnTime = TimeSpan.FromSeconds(1.5);
            TransitionOffTime = TimeSpan.FromSeconds(0.5);

            SetDifficulty();

            Global.GameInProgress.Exiting += GameInProgress_Exiting;
            _currentGameMode = GameMode.Multiplayer;
            _client = client;
            _playerNames = players;

            InitializeMultiplayerPlayers(_playerNames.Count);

            _cam = new Camera2D(new Viewport(0, 0, Global.DeviceInUse.GraphicsDevice.PresentationParameters.BackBufferWidth, Global.DeviceInUse.GraphicsDevice.PresentationParameters.BackBufferHeight), _multiPlayerOne);
            _multiPlayerOne.GetCamera(_cam);

            _lZombies = new List<Zombie>();
            AddZombies(_zombieModifier * _difficultyModifier);

        }
Esempio n. 3
0
        public void Update(GameTime gameTime, Camera2D camera)
        {
            _cam = camera;
            _gT = gameTime;

            var currentKeyboardState = Keyboard.GetState();
            var currentGamepadState = GamePad.GetState(PlayerIndex.One, GamePadDeadZone.Circular);
            var currentMouseState = Mouse.GetState();

            StayInScreen();

            UpdateMovement(currentKeyboardState, currentGamepadState);
            UpdateBullet(gameTime, currentMouseState, currentGamepadState);
            //UpdateSword(gameTime, currentMouseState, currentGamepadState);

            _previousMouseState = currentMouseState;
            _previousGamePadState = currentGamepadState;
            _previouseKeyboardState = currentKeyboardState;

            CheckTimers(gameTime);

            Update(gameTime, _speed, _direction);
        }
        /// <summary>
        /// Singleplayer Constructor
        /// </summary>
        public GameplayScreen()
        {
            TransitionOnTime = TimeSpan.FromSeconds(1.5);
            TransitionOffTime = TimeSpan.FromSeconds(0.5);

            _currentGameMode = GameMode.Singleplayer;

            SetDifficulty();

            _singlePlayerPlayer = new Player();
            _cam = new Camera2D(new Viewport(0, 0, Global.DeviceInUse.GraphicsDevice.PresentationParameters.BackBufferWidth, Global.DeviceInUse.GraphicsDevice.PresentationParameters.BackBufferHeight), _singlePlayerPlayer);
            _singlePlayerPlayer.GetCamera(_cam);

            _lZombies = new List<Zombie>();
            AddZombies(_zombieModifier * _difficultyModifier);

        }