예제 #1
0
    void EnterActiveState()
    {
        m_GameWorld.RegisterSceneEntities();

        m_resourceSystem = new BundledResourceManager(m_GameWorld, "BundledResources/Client");

        // Create serializers so we get errors in preview build
        var dataComponentSerializers = new DataComponentSerializers();

        m_CharacterModule    = new CharacterModulePreview(m_GameWorld, m_resourceSystem);
        m_PlayerModuleClient = new PlayerModuleClient(m_GameWorld);
        m_PlayerModuleServer = new PlayerModuleServer(m_GameWorld, m_resourceSystem);

        m_UpdateReplicatedOwnerFlag = m_GameWorld.GetECSWorld().CreateSystem <UpdateReplicatedOwnerFlag>(m_GameWorld);

        m_PlayerModuleClient.RegisterLocalPlayer(0, null);

        // Spawn PlayerState, Character and link up LocalPlayer
        m_Player = m_PlayerModuleServer.CreatePlayer(m_GameWorld, 0, "LocalMech", true);

        var playerEntity = m_Player.gameObject.GetComponent <GameObjectEntity>().Entity;
        //var charControl = m_Player.gameObject.GetComponent<PlayerCharacterControl>();
        var charControl = m_GameWorld.GetEntityManager().GetComponentObject <PlayerCharacterControl>(playerEntity);

        charControl.RequestedMechSettings = new MechSettings();
        m_Player.teamIndex = 0;

        m_previewGameMode = m_GameWorld.GetECSWorld().CreateSystem <PreviewGameMode>(m_GameWorld, m_Player);

        Game.SetMousePointerLock(true);
    }
예제 #2
0
    void EnterActiveState()
    {
        m_GameWorld.RegisterSceneEntities();

        m_resourceSystem = new BundledResourceManager(m_GameWorld, "BundledResources/Client");

        // Create serializers so we get errors in preview build
        var dataComponentSerializers = new DataComponentSerializers();

        m_CharacterModule          = new CharacterModulePreview(m_GameWorld, m_resourceSystem);
        m_ProjectileModule         = new ProjectileModuleClient(m_GameWorld, m_resourceSystem);
        m_HitCollisionModule       = new HitCollisionModule(m_GameWorld, 1, 2);
        m_PlayerModuleClient       = new PlayerModuleClient(m_GameWorld);
        m_PlayerModuleServer       = new PlayerModuleServer(m_GameWorld, m_resourceSystem);
        m_SpectatorCamModuleServer = new SpectatorCamModuleServer(m_GameWorld, m_resourceSystem);
        m_SpectatorCamModuleClient = new SpectatorCamModuleClient(m_GameWorld);
        m_EffectModule             = new EffectModuleClient(m_GameWorld, m_resourceSystem);
        m_ItemModule = new ItemModule(m_GameWorld);

        m_ragdollModule = new RagdollModule(m_GameWorld);

        m_DespawnProjectiles     = m_GameWorld.GetECSWorld().CreateSystem <DespawnProjectiles>(m_GameWorld);
        m_DamageAreaSystemServer = m_GameWorld.GetECSWorld().CreateSystem <DamageAreaSystemServer>(m_GameWorld);

        m_TeleporterSystemServer = m_GameWorld.GetECSWorld().CreateSystem <TeleporterSystemServer>(m_GameWorld);
        m_TeleporterSystemClient = m_GameWorld.GetECSWorld().CreateSystem <TeleporterSystemClient>(m_GameWorld);

        m_UpdateDestructableProps      = m_GameWorld.GetECSWorld().CreateSystem <UpdateDestructableProps>(m_GameWorld);
        m_DestructiblePropSystemClient = m_GameWorld.GetECSWorld().CreateSystem <DestructiblePropSystemClient>(m_GameWorld);

        m_UpdatePresentationOwners = m_GameWorld.GetECSWorld().CreateSystem <UpdatePresentationOwners>(
            m_GameWorld, m_resourceSystem);
        m_HandlePresentationOwnerDespawn = m_GameWorld.GetECSWorld().CreateSystem <HandlePresentationOwnerDesawn>(m_GameWorld);

        m_HandleGrenadeRequests    = m_GameWorld.GetECSWorld().CreateSystem <HandleGrenadeRequest>(m_GameWorld, m_resourceSystem);
        m_StartGrenadeMovement     = m_GameWorld.GetECSWorld().CreateSystem <StartGrenadeMovement>(m_GameWorld);
        m_FinalizeGrenadeMovement  = m_GameWorld.GetECSWorld().CreateSystem <FinalizeGrenadeMovement>(m_GameWorld);
        m_ApplyGrenadePresentation = m_GameWorld.GetECSWorld().CreateSystem <ApplyGrenadePresentation>(m_GameWorld);

        m_moverUpdate = m_GameWorld.GetECSWorld().CreateSystem <MoverUpdate>(m_GameWorld);

        m_SpinSystem = m_GameWorld.GetECSWorld().CreateSystem <SpinSystem>(m_GameWorld);
        m_HandleNamePlateOwnerSpawn   = m_GameWorld.GetECSWorld().CreateSystem <HandleNamePlateSpawn>(m_GameWorld);
        m_HandleNamePlateOwnerDespawn = m_GameWorld.GetECSWorld().CreateSystem <HandleNamePlateDespawn>(m_GameWorld);
        m_UpdateNamePlates            = m_GameWorld.GetECSWorld().CreateSystem <UpdateNamePlates>(m_GameWorld);

        m_UpdateReplicatedOwnerFlag = m_GameWorld.GetECSWorld().CreateSystem <UpdateReplicatedOwnerFlag>(m_GameWorld);


        m_TwistSystem          = new TwistSystem(m_GameWorld);
        m_FanSystem            = new FanSystem(m_GameWorld);
        m_TranslateScaleSystem = new TranslateScaleSystem(m_GameWorld);

        m_PlayerModuleClient.RegisterLocalPlayer(0, null);


        // Spawn PlayerState, Character and link up LocalPlayer
        m_Player = m_PlayerModuleServer.CreatePlayer(m_GameWorld, 0, "LocalHero", true);

        var playerEntity = m_Player.gameObject.GetComponent <GameObjectEntity>().Entity;
        var charControl  = m_GameWorld.GetEntityManager().GetComponentObject <PlayerCharacterControl>(playerEntity);

        charControl.characterType = math.max(Game.characterType.IntValue, 0);
        m_Player.teamIndex        = 0;

        m_previewGameMode = m_GameWorld.GetECSWorld().CreateSystem <PreviewGameMode>(m_GameWorld, m_Player);

        Game.SetMousePointerLock(true);
    }