コード例 #1
0
        public void SetupSimulation(SimulationParameters simulationParameters)
        {
            PersonCache = _container.GetInstance<IPersonCache>();

            _simulationParameters = simulationParameters;
            _universeFactory = new UniverseFactory(_container);

            _universeFactory.SetRandom(_container.GetInstance<Random>());
            _universeFactory.SetPersonCache(PersonCache);
            _universeFactory.SetPersonBuilder(
                new PersonBuilder(
                    _container.GetInstance<FirstNameGenerator>(),
                    _container.GetInstance<LastNameGenerator>(),
                    _container.GetInstance<Random>()));
            _universeFactory.GenerateRootTerritory();

            _universeFactory.AddLifeEvent<GetMarriedLifeEvent>()
                .AddLifeEvent<StartDatingLifeEvent>()
                .AddLifeEvent<OrphanChildLifeEvent>()
                .AddLifeEvent<GetEngagedLifeEvent>()
                .AddLifeEvent<BreakupLifeEvent>()
                .AddLifeEvent<SwitchJobLifeEvent>()
                .AddLifeEvent<HaveChildrenLifeEvent>()
                .AddLifeEvent<DeathLifeEvent>()
                .AddLifeEvent<SexReassignmentLifeEvent>()
                .AddLifeEvent<GenderChangeLifeEvent>()
                .AddLifeEvent<MoveLifeEvent>()
                .AddLifeEvent<SettleLifeEvent>()
                .AddLifeEvent<GetJobLifeEvent>()
                .AddLifeEvent<FiredLifeEvent>();

            _universe = _universeFactory.Build();

            RootTerritory = _universeFactory.GetRootTerritory();

            // TODO: Move this eventually:
            _universe.Start();
        }