Exemplo n.º 1
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();
        }
    public void ReplacePhysicsService(IPhysicsService newInstance)
    {
        var index     = GameComponentsLookup.PhysicsService;
        var component = (PhysicsServiceComponent)CreateComponent(index, typeof(PhysicsServiceComponent));

        component.instance = newInstance;
        ReplaceComponent(index, component);
    }
Exemplo n.º 3
0
 public ModeBase()
 {
     _deviceService  = ServiceLocator.Current.GetInstance <IDeviceService>();
     _turretService  = ServiceLocator.Current.GetInstance <ITurretService>();
     _configService  = ServiceLocator.Current.GetInstance <IConfigService>();
     _plantService   = ServiceLocator.Current.GetInstance <IPlantService>();
     _physicsService = ServiceLocator.Current.GetInstance <IPhysicsService>();
 }
        public Game1Proto6()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            //contentManager = new ContentManager(this.Services);

            PhysicsService = (IPhysicsService)new PhysicsComponent(this);
            PhysicsService.Simulator.Gravity.Y = 500;
            MessageSerivce = (IMessageService)new MessageDispatcher(this);
            RenderingService = (IRenderingService)new RenderingComponent(this);
        }
Exemplo n.º 5
0
        public Court(IGameControls gameControls, IPhysicsService physicsService, IJudgeService judgeService) : base(Locator.Get <IContentManagerService>().GetTexture("court"), Vector2.Zero, Color.White)
        {
            _gameControls   = gameControls;
            _physicsService = physicsService;
            _judgeService   = judgeService;

            _leftPaddle  = new LeftPaddle(gameControls, physicsService);
            _rightPaddle = new RightPaddle(gameControls, physicsService);
            _gameBall    = new Ball(physicsService);

            Rectangle = new Rectangle(this.Position.ToPoint(), new Point(Locator.ScreenBounds.Width, Locator.ScreenBounds.Height));
        }
    public GameEntity SetPhysicsService(IPhysicsService newInstance)
    {
        if (hasPhysicsService)
        {
            throw new Entitas.EntitasException("Could not set PhysicsService!\n" + this + " already has an entity with PhysicsServiceComponent!",
                                               "You should check if the context already has a physicsServiceEntity before setting it or use context.ReplacePhysicsService().");
        }
        var entity = CreateEntity();

        entity.AddPhysicsService(newInstance);
        return(entity);
    }
    public void ReplacePhysicsService(IPhysicsService newInstance)
    {
        var entity = physicsServiceEntity;

        if (entity == null)
        {
            entity = SetPhysicsService(newInstance);
        }
        else
        {
            entity.ReplacePhysicsService(newInstance);
        }
    }
 protected override void InitSubclass()
 {
     this.CoordinateType = CoordinateType.World;
     PhysicsService = (IPhysicsService)Owner.Game.Services.GetService(typeof(IPhysicsService));
     farseerDebugView = new DemoBaseXNA.PhysicsSimulatorView(PhysicsService.Simulator);
     RenderingService = (IRenderingService)Owner.Game.Services.GetService(typeof(IRenderingService));
     RenderingService.Register(this);
     this.DrawOrder = 0;
     this.Visible = true;
     farseerDebugView.LoadContent(Owner.Game.GraphicsDevice, Owner.Game.Content);
     farseerDebugView.EnablePerformancePanelBodyCount = true;
     farseerDebugView.LayerDepth = preLayer;
 }
Exemplo n.º 9
0
 public Services(ILogService log, IViewService view, IMouseInputService mouseInput, ILoadConfigService loadConfig, ISceneService scene, ICoroutineService coroutine, IKeyInputService keyInput, ITimeService time, IPhysicsService physics, INetworkService network, ILocalStorageService localStorage, IFileService file, ISettingService setting)
 {
     Log          = log;
     View         = view;
     MouseInput   = mouseInput;
     LoadConfig   = loadConfig;
     Scene        = scene;
     Coroutine    = coroutine;
     KeyInput     = keyInput;
     Time         = time;
     Physics      = physics;
     Network      = network;
     LocalStorage = localStorage;
     File         = file;
     Setting      = setting;
 }
 public CollisionEmissionSystem(Contexts contexts, Services services)
 {
     _contexts                  = contexts;
     _physicsService            = services.PhysicsService;
     _collisionEmisstionService = services.CollisionEmisstionService;
 }
Exemplo n.º 11
0
 public Ball(IPhysicsService physicsService) : base(Locator.Get <IContentManagerService>().GetTexture("ball"), Vector2.Zero, Color.White)
 {
     _physicsService = physicsService;
 }
Exemplo n.º 12
0
 public LeftPaddle(IGameControls gameControls, IPhysicsService physicsService) : base(gameControls, physicsService)
 {
 }
Exemplo n.º 13
0
 public Paddle(IGameControls gameControls, IPhysicsService physicsService) : base(Locator.Get <IContentManagerService>().GetTexture("paddleblue"), Vector2.Zero, Color.White)
 {
     _gameControls   = gameControls;
     _physicsService = physicsService;
 }
Exemplo n.º 14
0
 public GameControls(IPhysicsService physicsService, ISettingsService settingsService)
 {
     _physicsService  = physicsService;
     _settingsService = settingsService;
 }
 protected override void InitSubclass()
 {
     this.physicsService = (IPhysicsService)Owner.Game.Services.GetService(typeof(IPhysicsService));
 }
Exemplo n.º 16
0
        public override void LoadContent()
        {
            physicsService = ActorContext.GetRequiredService<IPhysicsService>();

            base.LoadContent();
        }
Exemplo n.º 17
0
 public RegisterPhysicsServiceSystem(Contexts contexts, IPhysicsService physicsService)
 {
     _context        = contexts.game;
     _physicsService = physicsService;
 }