Exemplo n.º 1
0
    private bool createRemotePlayer(DataEntityHandle remotePlayerHandle, bool attemptSpawn = true)
    {
        if (!dataEntityCollection.HasComponent <GameObjectReferenceData>(remotePlayerHandle))
        {
            dataEntityCollection.AddComponent <GameObjectReferenceData>(remotePlayerHandle);
        }
        if (!dataEntityCollection.HasComponent <AirBubbleData>(remotePlayerHandle))
        {
            dataEntityCollection.AddComponent <AirBubbleData>(remotePlayerHandle);
        }
        PositionData     component  = dataEntityCollection.GetComponent <PositionData>(remotePlayerHandle);
        RemotePlayerData component2 = dataEntityCollection.GetComponent <RemotePlayerData>(remotePlayerHandle);

        component2.PlayerRemoved += onPlayerRemoved;
        playerRemovedListeners.Add(component2);
        PresenceData component3 = dataEntityCollection.GetComponent <PresenceData>(remotePlayerHandle);

        if (component3 != null)
        {
            component3.PresenceDataUpdated += onPresenceDataUpdated;
        }
        if (!dataEntityCollection.HasComponent <LODRequestReference>(remotePlayerHandle))
        {
            LODRequestData requestData = new LODRequestData(LODSystem.REMOTE_PLAYER, remotePlayerHandle, component);
            requestData.OnGameObjectGeneratedEvent += onLODGameObjectGenerated;
            requestData.OnGameObjectRevokedEvent   += onLODGameObjectRevoked;
            LODRequest request = Service.Get <LODService>().Request(requestData, attemptSpawn);
            dataEntityCollection.AddComponent <LODRequestReference>(remotePlayerHandle).Request = request;
        }
        return(false);
    }
Exemplo n.º 2
0
 public LODRequest Request(LODRequestData requestData, bool attemptSpawn = true)
 {
     if (Manager == null)
     {
         throw new ArgumentException("Called Request with a null entity", "manager");
     }
     return(Manager.Request(requestData, attemptSpawn));
 }
    private void onGameObjectGenerated(GameObject remotePlayer, DataEntityHandle remotePlayerHandle, LODRequestData requestData)
    {
        LocomotionEventBroadcaster component = remotePlayer.GetComponent <LocomotionEventBroadcaster>();

        if (component != null)
        {
            component.OnDoActionEvent += onLocomotionBroadcasterDoAction;
        }
    }
Exemplo n.º 4
0
 public LODRequest Request(LODRequestData requestData, bool attemptSpawn = true)
 {
     return(getRequestSystem(requestData.Type).Request(requestData, attemptSpawn));
 }
Exemplo n.º 5
0
 private void onLODGameObjectRevoked(GameObject remotePlayer, DataEntityHandle remotePlayerHandle, LODRequestData requestData)
 {
     requestData.OnGameObjectGeneratedEvent -= onLODGameObjectGenerated;
     makeRenderersTransparent(remotePlayer, makeTransparent: true);
     if (!remotePlayerHandle.IsNull && dataEntityCollection.TryGetComponent(remotePlayerHandle, out GameObjectReferenceData component))
     {
         component.GameObject = null;
     }
 }
Exemplo n.º 6
0
    private void onLODGameObjectGenerated(GameObject remotePlayer, DataEntityHandle remotePlayerHandle, LODRequestData requestData)
    {
        requestData.OnGameObjectGeneratedEvent -= onLODGameObjectGenerated;
        remotePlayer.name = "rp_" + dataEntityCollection.GetComponent <DisplayNameData>(remotePlayerHandle).DisplayName;
        enableRenderers(remotePlayer, enable: false);
        remotePlayer.transform.SetParent(RemotePlayerContainer.transform);
        AvatarDataHandle component = remotePlayer.GetComponent <AvatarDataHandle>();

        component.SetHandle(remotePlayerHandle);
        remotePlayer.GetComponent <LocomotionReceiver>().Init();
    }
Exemplo n.º 7
0
    private void onGameObjectGenerated(GameObject remotePlayer, DataEntityHandle remotePlayerHandle, LODRequestData requestData)
    {
        LODWeightingCurve lODWeightingCurve = base.gameObject.AddComponent <LODWeightingCurve>();

        lODWeightingCurve.CurveData = Data.CurveData;
        lODWeightingCurve.Setup();
    }