Ejemplo n.º 1
0
    static IEnumerator StartRoutine(QuickStartSettings settings)
    {
        SimulationWorldSystem.ClearAllSimulationWorlds();

        SceneService.Load(Assets.emptyScene.name, LoadSceneMode.Additive, LocalPhysicsMode.Physics3D);

        yield return(null); // wait for scene load

        PlayerProfileService.Instance.SetPlayerProfile(settings.localProfileId);

        switch (settings.playMode)
        {
        case QuickStartSettings.PlayMode.Local:
            yield return(StartLocal(settings));

            break;

        case QuickStartSettings.PlayMode.OnlineClient:
            yield return(StartClient(settings));

            break;

        case QuickStartSettings.PlayMode.OnlineServer:
            yield return(StartServer(settings));

            break;
        }

        SceneService.UnloadAsync(Assets.emptyScene);
    }
Ejemplo n.º 2
0
    protected override void OnCreate()
    {
        base.OnCreate();

        _simWorldSystem = World.GetExistingSystem <SimulationWorldSystem>();
        _tickSystem     = World.GetExistingSystem <TickSimulationSystem>();
        _tickSystem.SimulationTicked += OnSimTick;
    }
    protected override void OnCreate()
    {
        base.OnCreate();

        SimulationWorldSystem worldMaster = World.GetOrCreateSystem <SimulationWorldSystem>();

        _simulationWorld = worldMaster.SimulationWorld;

        _preInitGroup = _simulationWorld.CreateSystem <SimPreInitializationSystemGroup>();
        _initGroup    = _simulationWorld.CreateSystem <SimInitializationSystemGroup>();
        _simGroup     = _simulationWorld.CreateSystem <SimSimulationSystemGroup>();
        _presGroup    = _simulationWorld.CreateSystem <SimPresentationSystemGroup>();

        _preInitGroup.AddSystemToUpdateList(_simulationWorld.CreateSystem <ChangeDetectionSystemEnd>());

        _initGroup.AddSystemToUpdateList(_simulationWorld.CreateSystem <BeginInitializationEntityCommandBufferSystem>());
        _initGroup.AddSystemToUpdateList(_simulationWorld.CreateSystem <EndInitializationEntityCommandBufferSystem>());
        _initGroup.AddSystemToUpdateList(_simulationWorld.CreateSystem <UpdateWorldTimeSystem>());

        _simGroup.AddSystemToUpdateList(_simulationWorld.CreateSystem <BeginSimulationEntityCommandBufferSystem>());
        _simGroup.AddSystemToUpdateList(_simulationWorld.CreateSystem <EndSimulationEntityCommandBufferSystem>());
        foreach (Type systemType in TypeUtility.GetECSTypesDerivedFrom(typeof(SimComponentSystem)))
        {
            _simGroup.AddSystemToUpdateList(_simulationWorld.CreateSystem(systemType));
        }
        foreach (Type systemType in TypeUtility.GetECSTypesDerivedFrom(typeof(SimJobComponentSystem)))
        {
            _simGroup.AddSystemToUpdateList(_simulationWorld.CreateSystem(systemType));
        }

        _presGroup.AddSystemToUpdateList(_simulationWorld.CreateSystem <BeginPresentationEntityCommandBufferSystem>());
        _presGroup.AddSystemToUpdateList(_simulationWorld.CreateSystem <ChangeDetectionSystemBegin>());

        _preInitGroup.SortSystemUpdateList();
        _initGroup.SortSystemUpdateList();
        _simGroup.SortSystemUpdateList();
        _presGroup.SortSystemUpdateList();

        _updatePlayerLoop = true;
    }
Ejemplo n.º 4
0
    protected override void OnCreate()
    {
        base.OnCreate();

        _worldMaster = World.GetOrCreateSystem <SimulationWorldSystem>();
    }