Example #1
0
 public CamerasController(
     UserManager <User> userManager,
     ICameraService cameraService)
 {
     this.userManager   = userManager;
     this.cameraService = cameraService;
 }
        public override void Initialize()
        {
            CameraManager = GameServiceManager.GetService <ICameraService>();

            ParentGameObject.OnMove += OnMove;
            base.Initialize();
        }
Example #3
0
 public UsersController(
     ICameraService cameras,
     IUserService users)
 {
     this.cameras = cameras;
     this.users   = users;
 }
        public ParameterPanelViewModel(
            ISerialService serialService,
            ICameraService cameraService,
            IParameterServices param,
            IStatusServices statusService,
            ICaptureService captureService,
            IEventAggregator eventAggregator)
        {
            _serialService   = serialService;
            _cameraService   = cameraService;
            _captureService  = captureService;
            Status           = statusService;
            _eventAggregator = eventAggregator;
            Params           = param;

            // ask for list update for initial value
            // _eventAggregator.GetEvent<ComListUpdateRequestedEvent>().Publish();

            Params.ManualPowerCheck.PropertyChanged += ManualPowerCheck_PropertyChanged;


            // restore remote configuration
            SyncRemoteSerialConfiguration();

            CameraInitialization();
        }
        public override void Destroy()
        {
            CameraManager = null;
            ParentGameObject.OnMove -= OnMove;

            base.Destroy();
        }
Example #6
0
        protected override void LimparMemoria()
        {
            _teeService      = null;
            _handicapService = null;
            _generoService   = null;
            _cameraService   = null;

            TeesExistentes    = null;
            GenerosExistentes = null;
            HandicapMinimo    = null;
            HandicapMaximo    = null;

            _jogador = null;
            Nome     = null;
            Email    = null;
            Foto     = null;
            Genero   = null;
            Tee      = null;
            Handicap = null;

            TirarFotoCommand      = null;
            GuardarDadosCommand   = null;
            RemoverJogadorCommand = null;
            CancelarEdicaoCommand = null;
            ResetEmailCommand     = null;

            base.LimparMemoria();
        }
Example #7
0
        /// <summary>
        /// Initialize here anything that depends on other services
        /// </summary>
        public override void Initialize()
        {
            base.Initialize();

            // get the camera service from service registry
            _cameraService = Services.GetService <ICameraService>();
        }
Example #8
0
 public CamerasController(
     ICameraService cameraService,
     UserManager <User> userManager)
 {
     this.cameraService = cameraService;
     this.userManager   = userManager;
 }
Example #9
0
        public IncidentMainPageModel(ILocationService locationService, IIncidentService incidentService,
                                     INavigationService navigationService, ICameraService cameraService)
        {
            Report             = null;
            _locationService   = locationService;
            _incidentService   = incidentService;
            _navigationService = navigationService;
            _cameraService     = cameraService;
            TypeOfRainItems    = EnumHelper <TypeOfRain> .GetDisplayItems();

            FloodDepthItems = EnumHelper <FloodDepth> .GetDisplayItems();

            FloodExtentItems = EnumHelper <FloodExtent> .GetDisplayItems();

            FrequencyOfFloodItems = EnumHelper <FrequencyOfFlood> .GetDisplayItems();

            TypeOfFloodingItems = EnumHelper <TypeOfFlood> .GetDisplayItems();

            TypesOfSpaceFloodedItems = EnumHelper <TypesOfSpaceFlooded> .GetDisplayItems();

            WaterClarityItems = EnumHelper <WaterClarity> .GetDisplayItems();

            TypeOfFloodings     = new List <int>();
            FloodDepth          = -1;
            FloodExtent         = -1;
            FrequencyOfFlood    = -1;
            TypesOfSpaceFlooded = -1;
            WaterClarity        = -1;
            TypeOfRain          = -1;
            TypeOfFlooding      = -1;
            LocalImages         = new ObservableCollection <LocalImage>();
        }
Example #10
0
        /// <summary>
        /// Initialize here anything that depends on other services
        /// </summary>
        public override void Initialize()
        {
            base.Initialize();

            // get the camera service from service registry
            _cameraService = Services.GetService<ICameraService>();
        }
 public GameService(IPlayerService playerService, INPCService npcService, ICameraService cameraService, SignalBus signalBus)
 {
     _playerService = playerService;
     _npcService    = npcService;
     _cameraService = cameraService;
     signalBus.Subscribe <SignalSpawnProjectile>(DisableService);
 }
 public VideoMonitoringViewModel(IUnityContainer container, IVideoService videoService, ICustomerService customerService, ICameraService cameraService)
 {
     _videoService     = videoService;
     _customerService  = customerService;
     _cameraService    = cameraService;
     VideoSurveillance = container.Resolve <VideoSurveillanceViewModel>();
 }
Example #13
0
 public void Initialize(float tau, ICameraService camera, GraphicsDevice graphicsDevice)
 {
     foreach (Level level in _levels)
     {
         level.Initialize(tau, camera, graphicsDevice);
     }
 }
        /// <summary>
        /// Initializes the internal state of the component
        /// </summary>
        public override void Initialize()
        {
            camera = (ICameraService)this.Game.Services.GetService(typeof(ICameraService));
            inputManager = (IInputManagerService)this.Game.Services.GetService(typeof(IInputManagerService));

            base.Initialize();
        }
Example #15
0
        public StatusPanelViewModel(IUnityContainer container, IStatusServices statusService, ILogService logService, IEventAggregator ea, ISerialService serialService, ICameraService cameraService)
        {
            _container     = container;
            _statusService = statusService;
            _logService    = logService;
            _ea            = ea;
            _serialService = serialService;
            _cameraService = cameraService;
            _logService.ConfigureLogger("StatusPanel");

            _serialPowerStatusTimer          = new Timer(_serialPowerStatusTimerInterval);
            _serialPowerStatusTimer.Elapsed += (sender, args) => SyncSerialPowerStatus();

            _serialCurrentStatusTimer          = new Timer(_serialCurrentStatusTimerInterval);
            _serialCurrentStatusTimer.Elapsed += (sender, args) => SyncCurrentStatus();

            _syncCameraTemperatureTimer          = new Timer(_syncCameraTemperatureTimerInterval);
            _syncCameraTemperatureTimer.Elapsed += (sender, args) => SyncCameraTemperature();

            _ea.GetEvent <ComConnectedEvent>().Subscribe(StartComStatusSynchronization);
            _ea.GetEvent <ComDisconnectedEvent>().Subscribe(StopComStatusSynchronization);

            _ea.GetEvent <VimbaConnectedEvent>().Subscribe(StartCameraStatusSynchronization);
            _ea.GetEvent <VimbaDisconnectedEvent>().Subscribe(StopCameraStatusSynchronization);
            _ea.GetEvent <ShutDownEvent>().Subscribe(Shutdown);
            _ea.GetEvent <StartCaptureEvent>().Subscribe(Shutdown);
            _ea.GetEvent <StopCaptureEvent>().Subscribe(Restart);
        }
 public AddFacePageViewModel(INavigationService navigationService, IApplicationManager applicationManager, ICameraService cameraService, IPageDialogService dialogService) : base(navigationService, applicationManager, dialogService)
 {
     Title          = "Register Face";
     _cameraService = cameraService;
     _dialogService = dialogService;
     ActivityIndicator activityIndicator = new ActivityIndicator();
 }
Example #17
0
 public CameraHub(ICameraService cameraService, ApiSettings settings)
 {
     _imageWidth    = settings.ImageWidth;
     _imageHeight   = settings.ImageHeight;
     _cameraService = cameraService;
     _settings      = settings;
 }
Example #18
0
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            // TODO: Add your initialization code here
            this.camera = this.Game.Services.GetService(typeof(ICameraService)) as ICameraService;

            if (this.camera == null)
            {
                throw new InvalidOperationException("ICameraService not found.");
            }

            this.gameMap = this.Game.Services.GetService(typeof(Map)) as Map;

            if (this.gameMap == null)
            {
                throw new InvalidOperationException("Map not found.");
            }

            this.player = this.Game.Services.GetService(typeof(Player)) as Player;
            if (this.player == null)
            {
                throw new InvalidOperationException("Player not found.");
            }

            this.shooter = this.Game.Services.GetService(typeof(Shooter)) as Shooter;
            if (this.shooter == null)
            {
                throw new InvalidOperationException("Shooter not found.");
            }

            base.Initialize();
        }
Example #19
0
 public MainPageViewModel(INavigationService navigationService, ICameraService cameraService, IVideoService videoService)
     : base(navigationService)
 {
     Title      = "Main Page";
     VideoNodes = new ObservableCollection <VideoNode>
     {
         new VideoNode
         {
             Author = "Play4u",
             Likes  = 10,
             Hearts = 15
         },
         new VideoNode
         {
             Author = "Mey4u",
             Likes  = 10,
             Hearts = 15
         }
     };
     CameraService          = cameraService;
     VideoService           = videoService;
     NavigateToLoginCommand = new DelegateCommand(async() => await NavigationService.NavigateAsync("/LoginPage"));
     ReactToHeartCommand    = new DelegateCommand(() => ReactToVideo(null, "heart"));
     ReactToLikeCommand     = new DelegateCommand <VideoNode>((n) => ReactToVideo(n, "like"));
     RecordVideoCommand     = new DelegateCommand(async() => await RecordVideo());
 }
        public override void Draw(GameTime gameTime)
        {
            ICameraService cameraService = (ICameraService)Game.Services.GetService(typeof(ICameraService));

            _model.Draw(Matrix.Identity, cameraService.View, cameraService.Projection);
            base.Draw(gameTime);
        }
Example #21
0
        public TurretService(IImageProcessorService imageProcessorService, ICameraService cameraService,
                             IConfigService configService, IDeviceService deviceService, IPlantService plantService,
                             IPhysicsService measurementService)
        {
            _imageProcessorService = imageProcessorService;
            _cameraService         = cameraService;
            _configService         = configService;
            _deviceService         = deviceService;
            _plantService          = plantService;
            _measurementService    = measurementService;

            ImageProcessorLock = new object();

            // 이미지 프로세싱 작업
            Task.Factory.StartNew(new Action(() =>
            {
                for (; ;)
                {
                    lock (ImageProcessorLock)
                    {
                        if ((DateTime.Now - ImageProcessed).TotalMilliseconds >= 50)
                        {
                            ImageProcess();
                        }
                    }
                    Thread.Sleep(30);
                }
            }));

            _tokenSource = new CancellationTokenSource();
            _exitEvent.Set();
        }
Example #22
0
 public SelectImageSourceViewModel()
 {
     _navigationService = App.Container.GetInstance <INavigationService>();
     _dialogService     = App.Container.GetInstance <IDialogService>();
     _cameraService     = App.Container.GetInstance <ICameraService>();
     _fileService       = App.Container.GetInstance <IFileService>();
 }
        public override void Initialize()
        {
            CameraManager = GameServiceManager.GetService<ICameraService>();

            ParentGameObject.OnMove += OnMove;
            base.Initialize();
        }
Example #24
0
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            // TODO: Add your initialization code here
            this.camera = this.Game.Services.GetService(typeof(ICameraService)) as ICameraService;

            if (this.camera == null)
            {
                throw new InvalidOperationException("ICameraService not found.");
            }

            this.gameMap = this.Game.Services.GetService(typeof(Map)) as Map;

            if (this.gameMap == null)
            {
                throw new InvalidOperationException("Map not found.");
            }

            this.player = this.Game.Services.GetService(typeof(Player)) as Player;
            if (this.player == null)
            {
                throw new InvalidOperationException("Player not found.");
            }

            this.shooter = this.Game.Services.GetService(typeof(Shooter)) as Shooter;
            if (this.shooter == null)
            {
                throw new InvalidOperationException("Shooter not found.");
            }

            base.Initialize();
        }
        public override void Destroy()
        {
            CameraManager            = null;
            ParentGameObject.OnMove -= OnMove;

            base.Destroy();
        }
Example #26
0
        public EditarJogadorPopupViewModel(INavigationService navigationService,
                                           IDialogService dialogService,
                                           ITeeService teeService,
                                           IHandicapService handicapService,
                                           IGeneroService generoService,
                                           ICameraService cameraService)
            : base(navigationService, dialogService)
        {
            _teeService      = teeService;
            _handicapService = handicapService;
            _generoService   = generoService;
            _cameraService   = cameraService;

            InicializarComunicacaoMediador();

            Task.Run(async() => await InicializarDados());

            Email = new ValidatableObject <string>();
            Email.RegrasValidacao.AddRange(new List <IValidationRule <string> >()
            {
                new EmailValidationRule <string>(), new EspacoEmBrancoValidationRule <string>(), new EmptyValidationRule <string>()
            });

            Nome = new ValidatableObject <string>();
            Nome.RegrasValidacao.AddRange(new List <IValidationRule <string> >()
            {
                new EspacoEmBrancoValidationRule <string>(), new EmptyValidationRule <string>()
            });
        }
Example #27
0
        public void Update(ICameraService camera)
        {
            // TODO: Maybe don't need to update levels for invisible patches?
            // set preferred tesselation levels for each patch
            for (int y = 0; y < _numPatchesY; y++)
            {
                for (int x = 0; x < _numPatchesX; x++)
                {
                    _patches[x, y].UpdateLevelOfDetail(camera);
                }
            }

            // now, make sure that each patch is no more than 1 level different from its neighbours
            // we loop through all patches, and if any are changed, set a flag. continue the outer
            // loop until the "changed" flag is false for all patches
            bool bChanged;

            do
            {
                bChanged = false;

                for (int y = 0; y < _numPatchesY; y++)
                {
                    for (int x = 0; x < _numPatchesX; x++)
                    {
                        // get the minimum level for neighbouring patches
                        Patch pPatch  = _patches[x, y];
                        int   nLevel  = pPatch.ActiveLevel;
                        int   nLeft   = pPatch.LeftActiveLevel;
                        int   nRight  = pPatch.RightActiveLevel;
                        int   nTop    = pPatch.TopActiveLevel;
                        int   nBottom = pPatch.BottomActiveLevel;

                        int nMinimumNeighbouringLevel = Math.Min(Math.Min(nLeft, nRight), Math.Min(nTop, nBottom));

                        if (nLevel > nMinimumNeighbouringLevel + 1)
                        {
                            pPatch.ActiveLevel = nMinimumNeighbouringLevel + 1;
                            bChanged           = true;
                        }
                    }
                }
            }while (bChanged);

            // finally, update geometry to match LOD
            for (int y = 0; y < _numPatchesY; y++)
            {
                for (int x = 0; x < _numPatchesX; x++)
                {
                    _patches[x, y].UpdateTessellation();
                }
            }

            /*int numVisible = 0;
             * for (int y = 0; y < _numPatchesY; y++)
             *      for (int x = 0; x < _numPatchesX; x++)
             *              if (_patches[x, y].Visible)
             *                      numVisible++;*/
        }
Example #28
0
 public LobyRoomPageViewModel(INavigationService navigationService, ICameraService cameraService, IVideoService videoService)
     : base(navigationService)
 {
     RedirectToCameraCommand = new DelegateCommand(async() => await RedirectToCameraAsync());
     RedirectToFeedCommand   = new DelegateCommand(async() => await RedirectToFeedAsync());
     CameraService           = cameraService;
     VideoService            = videoService;
 }
Example #29
0
        public async Task AttachAsync(ICameraService camera)
        {
            _camera      = camera;
            _faceTracker = await FaceTracker.CreateAsync();

            _frameProcessingTimer = new Timer((a) => { ProcessCurrentVideoFrame(); });
            _frameProcessingTimer.Change(0, 300);
        }
 public ImageImportViewModel(ICameraService cameraService, INavigationService navigationService, IRestService restService, IInternetConnectionService internetConnectionService) : base(navigationService)
 {
     Messenger.Default.Register <DataMessageToCreateFlashcard>(this, x => HandleDataMessage(x.DeckInstance));
     _navigationService         = navigationService;
     _cameraService             = cameraService;
     _restService               = restService;
     _internetConnectionService = internetConnectionService;
 }
 public CamerasController(
     UserManager <User> userManger,
     ICameraService cameras,
     IMapper mapper)
 {
     this.userManger = userManger;
     this.cameras    = cameras;
     this.mapper     = mapper;
 }
Example #32
0
        public Block(int n, ContentManager cm, Game1 g)
        {
            Content = cm;
            Device  = g.GraphicsDevice;
            Camera  = ((ICameraService)g.Services.GetService(typeof(ICameraService)));

            Initialize(n);
            LoadContent();
        }
Example #33
0
 public VideoMonitoringViewModel(IRegionManager regionManager, IUnityContainer container, IEventAggregator eventAggregator, ICustomerService customerService, ICameraService cameraService)
 {
     _regionManager   = regionManager;
     _container       = container;
     _customerService = customerService;
     _cameraService   = cameraService;
     _eventAggregator = eventAggregator;
     // VideoSurveillance = container.Resolve<VideoSurveillanceViewModel>();
 }
        public UserRegistrationPagePresenter(UserRegistrationPageViewModel viewModel, IMainService mainService)
        {
            _viewModel     = viewModel;
            _mainService   = mainService;
            _cameraService = mainService.GetCameraServiceInstance();
            _personService = mainService.GetPersonServiceInstance();

            BuildViewModel();
        }
Example #35
0
        public async Task AttachAsync(ICameraService camera)
        {
            _camera       = camera;
            _faceDetector = await FaceDetector.CreateAsync();

            var timerInterval = TimeSpan.FromMilliseconds(300);

            _frameProcessingTimer = ThreadPoolTimer.CreatePeriodicTimer(ProcessCurrentVideoFrame, timerInterval);
        }
        public override void Initialize()
        {
            base.Initialize();

            if (camera == null)
                camera = (ICameraService)Game.Services.GetService(typeof(ICameraService));

            if (effect == null)
                effect = new BasicEffect(Game.GraphicsDevice);
        }
Example #37
0
        private void RecalculateMinimumD(float tau, ICameraService camera, GraphicsDevice graphicsDevice)
        {
            // precalculate C
            float fA = camera.ProjectionNear / Math.Abs(camera.ProjectionTop); // 2
            float fT = 2 * tau / (float)graphicsDevice.Viewport.Height; // 0.01333
            float fC = fA / fT; // 150

            // we now have maximum delta
            float fMinimumD = _maximumDelta * fC;
            MinimumDSq = fMinimumD * fMinimumD;
        }
Example #38
0
        public override void Initialize()
        {
            base.Initialize();

            camera = (ICameraService)Game.Services.GetService(typeof(ICameraService));
            effect = new BasicEffect(Game.GraphicsDevice);

            vertices = new VertexPositionColor[2];

            for (int i = 0; i < 2; i++)
                vertices[i].Color = Color.Black;
        }
Example #39
0
        public void Update(ICameraService camera)
        {
            // TODO: Maybe don't need to update levels for invisible patches?
            // set preferred tesselation levels for each patch
            for (int y = 0; y < _numPatchesY; y++)
                for (int x = 0; x < _numPatchesX; x++)
                    _patches[x, y].UpdateLevelOfDetail(camera);

            // now, make sure that each patch is no more than 1 level different from its neighbours
            // we loop through all patches, and if any are changed, set a flag. continue the outer
            // loop until the "changed" flag is false for all patches
            bool bChanged;
            do
            {
                bChanged = false;

                for (int y = 0; y < _numPatchesY; y++)
                {
                    for (int x = 0; x < _numPatchesX; x++)
                    {
                        // get the minimum level for neighbouring patches
                        Patch pPatch = _patches[x, y];
                        int nLevel = pPatch.ActiveLevel;
                        int nLeft = pPatch.LeftActiveLevel;
                        int nRight = pPatch.RightActiveLevel;
                        int nTop = pPatch.TopActiveLevel;
                        int nBottom = pPatch.BottomActiveLevel;

                        int nMinimumNeighbouringLevel = Math.Min(Math.Min(nLeft, nRight), Math.Min(nTop, nBottom));

                        if (nLevel > nMinimumNeighbouringLevel + 1)
                        {
                            pPatch.ActiveLevel = nMinimumNeighbouringLevel + 1;
                            bChanged = true;
                        }
                    }
                }
            }
            while (bChanged);

            // finally, update geometry to match LOD
            for (int y = 0; y < _numPatchesY; y++)
                for (int x = 0; x < _numPatchesX; x++)
                    _patches[x, y].UpdateTessellation();

            /*int numVisible = 0;
            for (int y = 0; y < _numPatchesY; y++)
                for (int x = 0; x < _numPatchesX; x++)
                    if (_patches[x, y].Visible)
                        numVisible++;*/
        }
Example #40
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            camera = new CameraComponent(this);
            collision = new CollisionComponent(this);
            control = new ControlComponent(this);

            actorObj = new Actor();

            cameraService = (ICameraService)this.Services.GetService(typeof(ICameraService));
            controlService = (IControlService)this.Services.GetService(typeof(IControlService));
        }
Example #41
0
        public Wall(Game game, WallNode wallnode, Vector3 position)
            : base(game)
        {
            this.wall = wallnode;
            this.position = position;
            this.game = game;
            this.gdevice = this.game.GraphicsDevice;
            this.camera = this.game.Services.GetService(typeof(ICameraService)) as ICameraService;
            this.wallCube = new CubePrimitive(this.gdevice, InternalMap.GridSize);

            if (this.camera == null)
            {
                throw new InvalidOperationException("ICameraService not found.");
            }
        }
        public Map(Game game, Vector3 start, int width, int heigh)
            : base(game)
        {
            this.start = start;
            this.witdth = width;
            this.heigh = heigh;
            this.game = game;
            this.device = this.game.GraphicsDevice;
            this.camera = this.game.Services.GetService(typeof(ICameraService)) as ICameraService;

            if (this.camera == null)
            {
                throw new InvalidOperationException("ICameraService not found.");
            }
        }
Example #43
0
 public ImagingService(ICameraService cameraService, ILogService logService,
     IImageIoService ioService, ISystemEnvironment systemEnvironment)
 {
     _cameraService = cameraService;
     _logService = logService;
     _imageIoService = ioService;
     _systemEnvironment = systemEnvironment;
     ExposureVisualProcessingSettings = new ExposureVisualSettings()
     {
         AutoStretch = true,
         StretchMin = 0,
         StretchMax = -1
     };
     DarkFrameMode = false;
     IsSessionPaused = false;
 }
        public CameraViewModel(
            CameraModel camera, 
            ITrackerService trackerService, 
            ICameraService cameraService, 
            IConsoleService consoleService,
            HelixCameraVisualizationService visualizationService)
        {
            Camera = camera;
            TrackerService = trackerService;
            CameraService = cameraService;
            ConsoleService = consoleService;
            VisualizationService = visualizationService;

            CameraService.Initialize(Camera);
            TrackerService.Initialize(Camera);
            VisualizationService.Initialize(Camera);

            if (!IsInDesignMode)
            {
                Messenger.Default.Register<AddMotionControllerMessage>(this,
                    message =>
                    {
                        TrackerService.AddMotionController(message.MotionController);
                    });

                Messenger.Default.Register<RemoveMotionControllerMessage>(this,
                    message =>
                    {
                        TrackerService.RemoveMotionController(message.MotionController);
                    });

                // add existing controllers
                foreach (MotionControllerViewModel mcvw in SimpleIoc.Default.GetAllCreatedInstances<MotionControllerViewModel>())
                {
                    TrackerService.AddMotionController(mcvw.MotionController);
                }

                SimpleIoc.Default.Register(() => this, Camera.GUID, true);
                Messenger.Default.Send(new AddCameraMessage(Camera));
                // try loading previously saved configurations for this camera
                SimpleIoc.Default.GetInstance<ISettingsService>().LoadCamera(camera);
                Camera.Calibration = SimpleIoc.Default.GetInstance<SettingsViewModel>().SettingsService.LoadCalibration(Camera.GUID);
            }
        }
Example #45
0
        public Map(Game game, Vector3 start, int mapSeed)
            : base(game)
        {
            this.start = start;
            this.game = game;
            this.device = this.game.GraphicsDevice;
            this.camera = this.game.Services.GetService(typeof(ICameraService)) as ICameraService;
            this.defaultEfft = new BasicEffect(this.device);
            this.prevKeyboardState = Keyboard.GetState();

            if (this.camera == null)
            {
                throw new InvalidOperationException("ICameraService not found.");
            }

            this.internalMap = new InternalMap(160, 80, 8, 8, mapSeed);//new InternalMap(width, heigh, 8, 8);
            this.internalMap.GenerateRandomMap();
            this.internalMap.OptimizeMap();
            this.drawableRandomMapNode = new DrawableGameComponent[this.internalMap.MapNodeHeight, this.internalMap.MapNodeWidth];
            this.drawableOptimizedMapNode = new DrawableGameComponent[this.internalMap.MapNodeHeight, this.internalMap.MapNodeWidth];
            this.convertMapNodes(this.drawableRandomMapNode, this.internalMap.InternalMapStruct);
            this.convertMapNodes(this.drawableOptimizedMapNode, this.internalMap.OptimizedMapStruct);
            //this.internalMap.printMaps();
        }
Example #46
0
 public TargetAduFinder(ICameraService cameraService)
 {
     _cameraService = cameraService;
 }
Example #47
0
        public override void Initialize()
        {
            base.Initialize();

            // Grund-Positionen für die Ecken einer Seite eines Würfels
            positions = new Vector3[4]
            {
                new Vector3(-1.0f, -1.0f, 0.0f),
                new Vector3(-1.0f, 1.0f, 0.0f),
                new Vector3(1.0f, 1.0f, 0.0f),
                new Vector3(1.0f, -1.0f, 0.0f)
            };

            // Indices für die zwei Dreiecke einer Seite
            triangles = new int[2][]
            {
                new int[3] { 0, 1, 2 },
                new int[3] { 2, 3, 0 }
            };

            // rotes Dreieck für die Anzeige des geschnittenen Dreiecks
            triangle = new VertexPositionColor[3];

            for (int i = 0; i < 3; i++)
                triangle[i].Color = Color.Red;

            // vier Vertices zum Rendern einer Seite eines Würfels
            Vertex[] vertices = new Vertex[4];

            for (int i = 0; i < 4; i++)
            {
                vertices[i].Position = positions[i];
                vertices[i].Normal = Vector3.Backward;
            }

            // eine Transformationsmatrix pro Seite eines Würfels
            transformations = new Matrix[6];

            for (int i = 0; i < 6; i++)
            {
                transformations[i] = Matrix.CreateTranslation(Vector3.Backward);

                if (i < 4)
                    transformations[i] *= Matrix.CreateRotationY(i * MathHelper.PiOver2);
                else
                    transformations[i] *= Matrix.CreateRotationX(((i - 4) * 2 - 1) * MathHelper.PiOver2);
            }

            effect = new BasicEffect(GraphicsDevice);

            vertexBuffer = new VertexBuffer(GraphicsDevice, typeof(Vertex), 4, BufferUsage.WriteOnly);
            indexBuffer = new IndexBuffer(GraphicsDevice, IndexElementSize.ThirtyTwoBits, 4, BufferUsage.WriteOnly);

            // Vertex- und Indexbuffer zum Rendern einer Seite eines Würfels
            vertexBuffer.SetData<Vertex>(vertices);
            indexBuffer.SetData<int>(new int[4] { 0, 1, 3, 2 });

            camera = (ICameraService)Game.Services.GetService(typeof(ICameraService));

            Random random = new Random(0);

            // Würfel zufällig generieren
            for (int i = 0; i < 100; i++)
                AddCube((new Vector3(Next(), Next(), Next()) * 2.0f - Vector3.One) * 100.0f, Next() * 10.0f);

            spriteBatch = new SpriteBatch(GraphicsDevice);
        }
        public override void Initialize()
        {
            camera = (ICameraService)ScreenManager.Instance.Services.GetService(typeof(ICameraService));
            collisionSpaceRectangle = new RectangleF2(camera.VisibleArea.X,
                camera.VisibleArea.Y, camera.VisibleArea.Width + (bufferBins * binWidth), camera.VisibleArea.Height + (bufferBins * binHeight));
            if (collisionSpaceRectangle.Width > camera.VisibleArea.Width &&
               collisionSpaceRectangle.Height > camera.VisibleArea.Height)
            {
                offsetVector.X = (collisionSpaceRectangle.Width - camera.VisibleArea.Width)/2;
                offsetVector.Y = (collisionSpaceRectangle.Height - camera.VisibleArea.Height)/2;
            }

            gridWidth = (int)(collisionSpaceRectangle.Width / binWidth);
            gridHeight = (int)(collisionSpaceRectangle.Height / binHeight);
            objectCollisionGrid = new CollisionObjectBin[gridWidth, gridHeight];
            for (int y = 0; y < gridHeight; y++)
            {
                for (int x = 0; x < gridWidth; x++)
                {
                    objectCollisionGrid[x, y] = new CollisionObjectBin(this, x, y);
                }
            }
            base.Initialize();
        }
        public override void Initialize()
        {
            base.Initialize();

            camera = (ICameraService)this.Game.Services.GetService(typeof(ICameraService));
        }
		public InterceptorThatCauseStackOverflow(ICameraService service)
		{
		}
Example #51
0
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            basicEffect = new BasicEffect(this.game.GraphicsDevice);
            basicEffect.VertexColorEnabled = true;
            basicEffect.Projection = Matrix.CreateOrthographicOffCenter
               (0, this.game.GraphicsDevice.Viewport.Width,     // left, right
                this.game.GraphicsDevice.Viewport.Height, 0,    // bottom, top
                0, 1);                                         // near, far plane

            vertices = new VertexPositionColor[2];

            //Position and orientation
            playerPosition = new Vector3(0.0f, 0.0f, 2.0f);
            playerZRoatation = 0.0f;
            movingSpeed = 0.02f;
            shootingDistance = 20;
            playerWaitingTimerThres = 1000; //1s
            playerWaitingTimer = 0;
            playerTurnTimerThres = 5000; //5s
            playerTurnTimer = 0;

            opponentMovingSpeed = 0.02f;
            opponentShootingDistance = 20;

            //Animation
            playerAlphaTimer = 0;
            playerAlphaSpeed = 1;
            playerAlpha = 1.0f;
            lineEffect = new BasicEffect(this.Game.GraphicsDevice);
            lineEffect.VertexColorEnabled = true;

            this.camera = this.game.Services.GetService(typeof(ICameraService)) as ICameraService;
            if (this.camera == null)
            {
                throw new InvalidOperationException("ICameraService not found.");
            }

            this.path = this.game.Services.GetService(typeof(Path)) as Path;
            if (this.path == null)
            {
                throw new InvalidOperationException("Path not found.");
            }
            this.shooter = this.game.Services.GetService(typeof(Shooter)) as Shooter;
            if (this.shooter == null)
            {
                throw new InvalidOperationException("Shooter not found.");
            }
            this.networkingClient = this.game.Services.GetService(typeof(NetworkingClient)) as NetworkingClient;
            if (this.shooter == null)
            {
                throw new InvalidOperationException("Networking not found.");
            }
            this.map = this.game.Services.GetService(typeof(Map)) as Map;
            if (this.map == null)
            {
                throw new InvalidOperationException("Map not found.");
            }

            internalBoolMap = map.getCurrentDisplayedMapDetail();

            //this.playerId = networkingClient.GetPlayerId();

            base.Initialize();
        }
Example #52
0
        public void UpdateLevelOfDetail(ICameraService camera)
        {
            // calculate distance(sq) from centre of this patch to the camera
            Vector3 tDistance = _center - camera.Position;
            float fDistanceSq = tDistance.LengthSquared();

            // choose which level to use
            ActiveLevel = 0;
            for (short i = 1; i < _levels.Length; i++)
                if (fDistanceSq > _levels[i].MinimumDSq)
                    ActiveLevel = i;
        }
        /// <summary>
        /// Method to get a 3D objects 2D scren coords.
        /// </summary>
        /// <param name="myPosition"></param>
        /// <param name="Camera"></param>
        /// <returns></returns>
        public static Vector2 Get2DCoords(Vector3 myPosition, ICameraService Camera)
        {
            Matrix ViewProjectionMatrix = Camera.View * Camera.Projection;

            Vector4 result4 = Vector4.Transform(myPosition, ViewProjectionMatrix);

            if (result4.W <= 0)
                return new Vector2(Camera.Viewport.Width, 0);

            Vector3 result = new Vector3(result4.X / result4.W, result4.Y / result4.W, result4.Z / result4.W);

            Vector2 retVal = new Vector2((int)Math.Round(+result.X * (Camera.Viewport.Width / 2)) + (Camera.Viewport.Width / 2), (int)Math.Round(-result.Y * (Camera.Viewport.Height / 2)) + (Camera.Viewport.Height / 2));
            return retVal;
        }
        public static Ray BuildRay(Point screenPixel, ICameraService camera)
        {
            Vector3 nearSource = camera.Viewport.Unproject(new Vector3(screenPixel.X, screenPixel.Y, camera.Viewport.MinDepth), camera.Projection, camera.View, Matrix.Identity);
            Vector3 farSource = camera.Viewport.Unproject(new Vector3(screenPixel.X, screenPixel.Y, camera.Viewport.MaxDepth), camera.Projection, camera.View, Matrix.Identity);
            Vector3 direction = farSource - nearSource;

            direction.Normalize();

            return new Ray(nearSource, direction);
        }
        /// <summary>
        /// Method to get screens tex coords.
        /// </summary>
        /// <param name="worldPosition"></param>
        /// <param name="Camera"></param>
        /// <returns></returns>
        public static Vector2 GetScreenTexCoords(Vector3 worldPosition, ICameraService Camera)
        {
            Vector2 retVal;

            retVal = Get2DCoords(worldPosition, Camera);

            retVal.X /= Camera.Viewport.Width;
            retVal.Y /= Camera.Viewport.Height;

            return retVal;
        }
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            Graphics.PreferredBackBufferWidth = Constants.InternalResolutionWidth;
            Graphics.PreferredBackBufferHeight = Constants.InternalResolutionHeight;

            Graphics.SynchronizeWithVerticalRetrace = false;
            IsFixedTimeStep = false;

            Graphics.ApplyChanges();

            //Components.Add(new FrameRateCounter(this, "Content\\Fonts\\fpsfont", 1f));
            Components.Add(new GameObjectInfoDisplay(this, 0.5f, "Content\\Fonts\\debugfont", new Vector2(0f, 25f)));


            var componentFactory = new ComponentFactory();
            var gameObjectFactory = new GameObjectFactory(this.Content);
            gameObjectFactory.PathToXML = "EntityDefinitions\\entity.xml";

            var inputHandler = new InputHandler(false);
            var playerManager = new PlayerManager();

            var collisionManager = new CollisionManager(new RectangleF(0f, 0f, Constants.InternalResolutionWidth, Constants.InternalResolutionHeight));

            particleManager = new ParticleManager(Content, "ParticleEffects\\", "Textures\\");

            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            renderer = new Renderer(Graphics, spriteBatch);
            renderer.SpriteSortMode = SpriteSortMode.FrontToBack;
            renderer.SetInternalResolution(Constants.InternalResolutionWidth, Constants.InternalResolutionHeight);
            renderer.SetScreenResolution(1920, 1080, false);

            particleRenderer = new SpriteBatchRenderer();
            particleRenderer.GraphicsDeviceService = Graphics;

            cameraService =  new CameraManager();

            var camera = new BasicCamera2D(GraphicsDevice, "main");

            cameraService.AddCamera(camera);

            GameServiceManager.AddService(typeof(IGameObjectFactory), gameObjectFactory);
            GameServiceManager.AddService(typeof(IComponentFactory), componentFactory);
            GameServiceManager.AddService(typeof(RenderableFactory), new RenderableFactory(Content));
            GameServiceManager.AddService(typeof(IInputHandler), inputHandler);
            GameServiceManager.AddService(typeof(PlayerManager), playerManager);
            GameServiceManager.AddService(typeof(IGameObjectManager), new GameObjectManager());
            GameServiceManager.AddService(typeof(ICollisionManager), collisionManager);
            GameServiceManager.AddService(typeof(IBehaviorFactory), new BehaviorFactory());
            GameServiceManager.AddService(typeof(IActionFactory), new ActionFactory());
            GameServiceManager.AddService(typeof(IRandomGenerator), new RandomGenerator());
            GameServiceManager.AddService(typeof(IParticleManager), particleManager);
            GameServiceManager.AddService(typeof(IProjectileManager), new ProjectileManager());
            GameServiceManager.AddService(typeof(IActionManager), new ActionManager());
            GameServiceManager.AddService(typeof(ILayerManager), new LayerManager("layers.xml", Content));
            GameServiceManager.AddService(typeof(IRenderer), renderer);
            GameServiceManager.AddService(typeof(ICameraService), cameraService);
            GameServiceManager.AddService(typeof(ILevelLogicManager), new LevelLogicManager());

            //Initialize the GameServices););
            foreach (var service in GameServiceManager.Services)
            {
                service.Initialize();
            }

            base.Initialize();
        }
        public static float RayPicking(Point screenPixel, BoundingBox volume, ICameraService camera)
        {
            Nullable<float> retVal = float.MaxValue;

            BuildRay(screenPixel, camera).Intersects(ref volume, out retVal);

            if (retVal != null)
                return retVal.Value;
            else
                return float.MaxValue;
        }
 public override void Initialize()
 {
     camera = (ICameraService)ScreenManager.Instance.Services.GetService(typeof(ICameraService));
     base.Initialize();
     this.physicsHandler = new PhysicsHandler(this);
 }
Example #59
0
 public void Initialize(float tau, ICameraService camera, GraphicsDevice graphicsDevice)
 {
     foreach (Level level in _levels)
         level.Initialize(tau, camera, graphicsDevice);
 }
        private void initialize(int sensorIdx)
        {
            Enabled = true;

            cameraService = SpringUtil.getService<ICameraService>();
            sensorService = SpringUtil.getService<ISensorService>();
            skeletonService = SpringUtil.getService<ISkeletonService>();
            gestureService = SpringUtil.getService<IGestureService>();

            sensorService.startSensor(sensorIdx);
            cameraService.startCameraService(sensorService.getSensor(sensorIdx));
            skeletonService.enableSkeleton(sensorService.getSensor(sensorIdx));
            gestureService.enableGestureService(sensorService.getSensor(sensorIdx));

            imgHandLeft = new BitmapImage(new Uri(Application.Current.StartupUri, IMAGE_HAND_LEFT));
            imgHandRight = new BitmapImage(new Uri(Application.Current.StartupUri, IMAGE_HAND_RIGHT));
            imgHandLeftActive = new BitmapImage(new Uri(Application.Current.StartupUri, IMAGE_HAND_LEFT_ACTIVE));
            imgHandRightActive = new BitmapImage(new Uri(Application.Current.StartupUri, IMAGE_HAND_RIGHT_ACTIVE));

            imgHandLeft.Freeze();
            imgHandRight.Freeze();
            imgHandLeftActive.Freeze();
            imgHandRightActive.Freeze();
        }