Progress character customization

This commit is contained in:
Lauchstange committed 2025-01-30 21:02:41 +01:00
1 parent bf545f3baf
commit 5708c0bbbd
20 files changed
+327 -191

No files matched your search

@@ -11,7 +11,6 @@ namespace Client
{
private EntityQuery _pendingNetworkIdQuery;
[BurstCompile]
public void OnCreate(ref SystemState state)
{
//Get all entities connected to the server (having networkID), but not in game yet (no NetworkStreamInGame)
@@ -23,42 +22,36 @@ namespace Client
state.RequireForUpdate<ClientTeamRequest>();
}
[BurstCompile]
public void OnUpdate(ref SystemState state)
{
//Get Requested team and all network ids that want to join
var teamrequest = SystemAPI.GetSingleton<ClientTeamRequest>();
var ecb = new EntityCommandBuffer(Allocator.Temp);
var requestedTeam = SystemAPI.GetSingleton<ClientTeamRequest>().Value;
var requestedColor = SystemAPI.GetSingleton<ClientTeamRequest>().Color;
var pendingNetworkIds = _pendingNetworkIdQuery.ToEntityArray(Allocator.Temp);
foreach (var pendingNetworkId in pendingNetworkIds)
{
//mark network ID as joined in game - it will receive Snapshots
ecb.AddComponent<NetworkStreamInGame>(pendingNetworkId);
//create entity that holds request
var requestTeamEntity = ecb.CreateEntity();
//Give entity Rpc command request and team request so that the server can handle it
ecb.AddComponent(requestTeamEntity, new TdTeamRequest
{
Value = requestedTeam,
Color = requestedColor
Value = teamrequest.Value,
Color = teamrequest.Color
});
ecb.AddComponent(requestTeamEntity, new SendRpcCommandRequest()
{
TargetConnection = pendingNetworkId
});
//Broadcast Rpc
ecb.Playback(state.EntityManager);
}
}
[BurstCompile]
public void OnDestroy(ref SystemState state)
{
//Broadcast Rpc
ecb.Playback(state.EntityManager);
}
}
}
+2 -2
View File
@@ -6,7 +6,7 @@ namespace Client
{
public struct ClientTeamRequest : IComponentData
{
public TeamType Value;
public Color Color;
public TeamType Value;
public Color Color;
}
}