Esempio n. 1
0
        public override void OnLoad(IKernel kernel)
        {
            Kernel.Bind<ComponentService>().To<ComponentService>().InSingletonScope();

            Kernel.Bind<IAlgorithmProvider<IHandleEvent, Type>>().To<HandleEventAlgorithmProvider>().InSingletonScope();
            Kernel.Bind<IFinder<IHandleEvent, Type>>().To<Finder<IHandleEvent, Type>>().InSingletonScope();
            Kernel.Bind<IEventProcessor>().To<EventProcessor>().InSingletonScope();
            Kernel.Bind<IHandleEvent>().To<HandleDefaultEvent>().InSingletonScope();
            Kernel.Bind<IHandleEvent>().To<HandleProductionCompletedEvent>().InSingletonScope();
            Kernel.Bind<IHandleEvent>().To<HandleComponentSpottedEvent>().InSingletonScope();
            Kernel.Bind<IHandleEvent>().To<HandleComponentLeftFieldOfVisionEvent>().InSingletonScope();
            Kernel.Bind<IHandleEvent>().To<HandleComponentLostEvent>().InSingletonScope();
            Kernel.Bind<IHandleEvent>().To<HandleMoveUnitEvent>().InSingletonScope();
            Kernel.Bind<IHandleEvent>().To<HandleMoveUnitCompletedEvent>().InSingletonScope();
            Kernel.Bind<IHandleEvent>().To<HandleComponentDestroyedEvent>().InSingletonScope();
            Kernel.Bind<IHandleEvent>().To<HandleUnitAttacksEvent>().InSingletonScope();
            Kernel.Bind<IHandleEvent>().To<HandleUnitAttackCompletedEvent>().InSingletonScope();

            Kernel.Bind<IRepository<GameEnvironment>>().To<GameEnvironmentProvider>().InSingletonScope();
            Kernel.Bind<IVector2Service>().To<Vector2Service>().InSingletonScope();
            Kernel.Bind<IOrientationService>().To<OrientationService>().InSingletonScope();

            Kernel.Bind<IStrategieFactory>().To<StrategieFactory>().InSingletonScope();

            Kernel.Bind<ITryGetResultHandlingProcessor<UnitBase, Situation>>().To<TryGetResultHandlingProcessor<UnitBase, Situation>>().InSingletonScope();
            Kernel.Bind<IHandlingProvider<ITryGetResultHandling<UnitBase, Situation>>>().To<InjectionHandlingProvider<ITryGetResultHandling<UnitBase, Situation>, ISituationRule>>().InSingletonScope();
            Kernel.Bind<ISituationRule>().To<AttackingSituationRule>().InSingletonScope();
            Kernel.Bind<ISituationRule>().To<MovingSituationRule>().InSingletonScope();
            Kernel.Bind<ISituationRule>().To<DoNothingSituationRule>().InSingletonScope();

            Kernel.Bind<ICHProcessor<UnitStratey>>().To<CHProcessor<UnitStratey>>().InSingletonScope();
            Kernel.Bind<IParallelizableHandlingProvider<ICH<UnitStratey>>>().To<UnitStrateyCHProvider>().InSingletonScope();
            Kernel.Bind<UnitStrategyRule>().To<GetEnemysAroundUnitStrategy>().InSingletonScope();
            Kernel.Bind<UnitStrategyRule>().To<GetMakesAttackSenseStrategy>().InSingletonScope();
            Kernel.Bind<UnitStrategyRule>().To<GetPreferedVictimStrategy>().InSingletonScope();

            Kernel.Bind<ICHProcessor<Strategy>>().To<CHProcessor<Strategy>>().InSingletonScope();
            Kernel.Bind<IParallelizableHandlingProvider<ICH<Strategy>>>().To<InjectionParallelizableHandlingProvider<ICH<Strategy>, IStrategyRule>>().InSingletonScope();
            Kernel.Bind<IStrategyRule>().To<AttackRule>().InSingletonScope();
            Kernel.Bind<IStrategyRule>().To<BuildBarrackRule>().InSingletonScope();
            Kernel.Bind<IStrategyRule>().To<BuildInfanteryRule>().InSingletonScope();
            Kernel.Bind<IStrategyRule>().To<MoveInfanteryRule>().InSingletonScope();
            Kernel.Bind<IStrategyRule>().To<LowHealthUnitsWalkTogetherRule>().InSingletonScope();
            Kernel.Bind<IStrategyRule>().To<DefendBarrackRule>().InSingletonScope();

            Kernel.Bind<AIDto>().ToConstant(_ai).InSingletonScope();
            Kernel.Bind<ArtificialIntelligenceBase>().ToConstant(_ai.AI).InSingletonScope();

            Kernel.Bind<IEventStoreService>().To<EventStoreService>().InSingletonScope();
        }
Esempio n. 2
0
 public override void AddModule(IKernel kernel)
 {
     kernel.Load(new LightContribInjectionModule());
 }