private void Run(float gameTime)
        {
            // update all players positions
            var command = new AllPlayersCommand();

            command.Run(_server, null, null, this);
        }
Example #2
0
        private void Run(double gameTime)
        {
            //ManagerCamera.Move(Direction.Up); //For test
            ManagerCamera.Update(gameTime);

            var list = new List <Entity>();

            list.AddRange(Players.Select(p => p.Player));
            list.AddRange(Enemies);
            foreach (var entity in list)
            {
                entity.Update(gameTime);


                var entityPosition = entity.Position;
                var position       = new Vector2(entityPosition.XPosition, entityPosition.YPosition);
                if (ManagerCamera.InScreenCheck(position))
                {
                    var screenPosition =
                        ManagerCamera.WorldToScreenPosition(new Vector2(position.X, position.Y));

                    entityPosition.ScreenXPosition = (int)screenPosition.X;
                    entityPosition.ScreenYPosition = (int)screenPosition.Y;
                }
            }

            var command = new AllPlayersCommand {
                CameraUpdate = true
            };

            command.Run(_logger, _server, null, null, this);
            var commandE = new AllEnemiesCommand {
                CameraUpdate = true
            };

            commandE.Run(_logger, _server, null, null, this);
        }