Beispiel #1
0
 public ContentLoader(IEventSystem eventSystem, IEntityDatabase entityDatabase,
                      IF_IContentPluginLoader contentPluginLoader)
 {
     this.eventSystem         = eventSystem;
     this.entityDatabase      = entityDatabase;
     this.contentPluginLoader = contentPluginLoader;
 }
 public static void RemoveEntities(this IEntityDatabase entityDatabase, params IEntity[] entities)
 {
     for (var i = 0; i < entities.Length; i++)
     {
         RemoveEntity(entityDatabase, entities[i]);
     }
 }
Beispiel #3
0
 public GameBoardViewResolver(IEventSystem eventSystem, IEntityDatabase entityDatabase,
                              IUnityInstantiator instantiator, FloorTiles floorTiles, OuterWallTiles outerWallTiles)
     : base(eventSystem, entityDatabase, instantiator)
 {
     _floorTiles     = floorTiles;
     _outerWallTiles = outerWallTiles;
 }
 public static void RemoveEntities(this IEntityDatabase entityDatabase, IEnumerable <IEntity> entities)
 {
     foreach (var entity in entities)
     {
         RemoveEntity(entityDatabase, entity);
     }
 }
 public static void RemoveEntitiesContaining(this IEntityDatabase entityDatabase, params Type[] components)
 {
     foreach (var pool in entityDatabase.Collections)
     {
         pool.RemoveEntitiesContaining(components);
     }
 }
Beispiel #6
0
 public IF_VR_Glove_SteamVRManus_Example_InteractableSystem(IEventSystem eventSystem,
                                                            IEntityDatabase entityDatabase,
                                                            IF_VR_Glove_IInterface vrGloveInterface)
 {
     this.eventSystem      = eventSystem;
     this.entityDatabase   = entityDatabase;
     this.vrGloveInterface = vrGloveInterface;
 }
        public ObservableGroupManager(IObservableGroupFactory observableGroupFactory, IEntityDatabase entityDatabase, IComponentTypeLookup componentTypeLookup)
        {
            ObservableGroupFactory = observableGroupFactory;
            EntityDatabase         = entityDatabase;
            ComponentTypeLookup    = componentTypeLookup;

            _observableGroups = new ObservableGroupLookup();
        }
 public IF_VR_Glove_HandSystem(IEntityDatabase entityDatabase,
                               IF_VR_IInterface vrInterface,
                               IF_VR_Glove_IInterface vrGloveInterface,
                               IF_IGameObjectTool gameObjectTool)
 {
     this.entityDatabase   = entityDatabase;
     this.vrInterface      = vrInterface;
     this.vrGloveInterface = vrGloveInterface;
     this.gameObjectTool   = gameObjectTool;
 }
 public IF_VR_Glove_SteamVRManus_HandSystem(IF_IGameObjectTool gameObjectTool,
                                            IF_VR_IInterface vrInterface,
                                            IF_VR_Glove_IInterface vrGloveInterface,
                                            IEntityDatabase entityDatabase,
                                            IEventSystem eventSystem)
 {
     this.gameObjectTool   = gameObjectTool;
     this.vrInterface      = vrInterface;
     this.vrGloveInterface = vrGloveInterface;
     this.entityDatabase   = entityDatabase;
     this.eventSystem      = eventSystem;
 }
        public static IEntityDatabase GetEntityDatabase()
        {
            if (entityAssetDatabase == null)
            {
//                #if UNITY_EDITOR
                entityAssetDatabase = new EntityAssetDatabase();
//                #else
//                entityAssetDatabase = new EntityJsonAssetDatabase();
//                #endif
            }
            return(entityAssetDatabase);
        }
    private void Awake()
    {
        _injector        = new Injector();
        _directCommand   = new DirectCommand(_injector);
        _eventDispatcher = new EventDispatcher();
        _eventCommandMap = new EventCommandMap(_eventDispatcher, _injector);
        _viewFactory     = new ViewFactory();
        _mediatorMap     = new MediatorMap(_viewFactory, _injector);
        _entityDatabase  = new EntityDatabase();
        _systemMap       = new SystemMap(_entityDatabase);
        _updater         = new Updater();

        _injector.Inject(_directCommand);
        _injector.Inject(_eventDispatcher);
        _injector.Inject(_entityDatabase);
        _injector.Inject(_mediatorMap);
        _injector.Inject <IUpdater>(_updater);

        // systems
        _systemMap.Add(new PlayerMovementSystem());
        _systemMap.Add(new PlayerShootingSystem());
        _systemMap.Add(new CameraFollowSystem());
        _systemMap.Add(new EnemySpawnerSystem());
        _systemMap.Add(new EnemyMovementSystem());
        _systemMap.Add(new EnemyDamageSystem());
        _systemMap.Add(new EnemyAttackSystem());
        _systemMap.Add(new PlayerDamageSystem());
        _systemMap.Add(new EnemySinkingSystem());

        // injection
        _injector.Inject <IGameData>(gameData);
        _injector.Inject(new AudioModel());
        _injector.Inject(new PlayerHealthModel());
        _injector.Inject(new ScoreModel());

        // view factory
        _viewFactory.Register(damageView, false);
        _viewFactory.Register(gameOverView, false);
        _viewFactory.Register(healthView, false);
        _viewFactory.Register(pauseView, false);
        _viewFactory.Register(scoreView, false);

        // mediator
        _mediatorMap.Map <DamageMediator>(ViewType.Damage);
        _mediatorMap.Map <GameOverMediator>(ViewType.GameOver);
        _mediatorMap.Map <HealthMediator>(ViewType.Health);
        _mediatorMap.Map <PauseMediator>(ViewType.Pause);
        _mediatorMap.Map <ScoreMediator>(ViewType.Score);

        // event command
        _eventCommandMap.Map(GameEvent.GameOverComplete, new RestartCommand());
    }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            continueScan = false;
            MobileBarcodeScanner.Initialize(Application);
            scanner = new MobileBarcodeScanner();
            SetContentView(Resource.Layout.ScanEvent);
            settings = new JsonSerializerSettings {
                TypeNameHandling = TypeNameHandling.All
            };
            database = EntityDatabase.get();
            Button scan = FindViewById <Button> (Resource.Id.buttonScan);

            scan.Click += async delegate {
                continueScan = false;
                var result = await scanner.Scan();

                HandleScanResult(result);
            };
            Button done = FindViewById <Button> (Resource.Id.buttonScanEventDone);

            done.Click += (sender, e) => Finish();
        }
 public FoodViewResolver(IEventSystem eventSystem, IEntityDatabase entityDatabase, IUnityInstantiator instantiator, FoodTiles foodTiles)
     : base(eventSystem, entityDatabase, instantiator)
 {
     _foodTiles = foodTiles;
 }
        public static void RemoveEntity(this IEntityDatabase entityDatabase, IEntity entity)
        {
            var containingPool = entityDatabase.GetCollectionFor(entity);

            containingPool.RemoveEntity(entity.Id);
        }
        public static void RemoveEntities(this IEntityDatabase entityDatabase, Func <IEntity, bool> predicate)
        {
            var matchingEntities = entityDatabase.Collections.SelectMany(x => x).Where(predicate).ToArray();

            RemoveEntities(entityDatabase, matchingEntities);
        }
 public static IEntityCollection GetCollectionFor(this IEntityDatabase entityDatabase, IEntity entity)
 {
     return(entityDatabase.Collections.SingleOrDefault(x => x.ContainsEntity(entity.Id)));
 }
Beispiel #17
0
 public IF_VR_InteractableSystem(IEntityDatabase entityDatabase)
 {
     this.entityDatabase = entityDatabase;
 }
 public RandomlyPlacedSetupSystem(IEntityDatabase entityDatabase)
 {
     EntityDatabase = entityDatabase;
 }
Beispiel #19
0
 protected PrefabViewResolverSystem(IEntityDatabase entityDatabase, IEventSystem eventSystem, IUnityInstantiator instantiator) : base(eventSystem)
 {
     EntityDatabase = entityDatabase;
     Instantiator   = instantiator;
     ViewHandler    = CreateViewHandler();
 }
Beispiel #20
0
 public Task Execute(IEntityDatabase entityDatabase)
 {
     return(Execute(entityDatabase, null));
 }
 public SphereViewResolver(IEntityDatabase entityDatabase, IEventSystem eventSystem, IUnityInstantiator instantiator)
     : base(entityDatabase, eventSystem, instantiator)
 {
 }
 public FoodPickupSystem(IEventSystem eventSystem, IEntityDatabase entityDatabase) : base(eventSystem)
 {
     _entityDatabase = entityDatabase;
 }
Beispiel #23
0
 public WallHitSystem(IEventSystem eventSystem, IEntityDatabase entityDatabase) : base(eventSystem)
 {
     _entityDatabase = entityDatabase;
 }
Beispiel #24
0
 public EnemyViewResolver(IEventSystem eventSystem, IEntityDatabase entityDatabase, IUnityInstantiator instantiator, EnemyTiles enemyTiles)
     : base(eventSystem, entityDatabase, instantiator)
 {
     _enemyTiles = enemyTiles;
 }
Beispiel #25
0
 public SpawnerSystem(IEntityDatabase entityDatabase)
 {
     DefaultCollection = entityDatabase.GetCollection();
 }
Beispiel #26
0
 public IF_FollowEntitySystem(IEntityDatabase entityDatabase)
 {
     this.entityDatabase = entityDatabase;
 }
Beispiel #27
0
 protected DynamicViewResolverSystem(IEventSystem eventSystem, IEntityDatabase entityDatabase, IUnityInstantiator instantiator)
 {
     EventSystem    = eventSystem;
     EntityDatabase = entityDatabase;
     Instantiator   = instantiator;
 }
Beispiel #28
0
 public WallHitSystem(IEntityDatabase entityDatabase)
 {
     _entityDatabase = entityDatabase;
 }
 public static IEntity GetEntity(this IEntityDatabase entityDatabase, int id)
 {
     return(entityDatabase.Collections
            .Select(collection => collection.GetEntity(id))
            .FirstOrDefault(possibleEntity => possibleEntity != null));
 }
Beispiel #30
0
 public ContentInfoSystem(IEntityDatabase entityDatabase, IEventSystem eventSystem)
 {
     this.entityDatabase = entityDatabase;
     this.eventSystem    = eventSystem;
 }