Start FPS controls
This commit is contained in:
1 parent
be5a424911
commit
08e27ca2f1
16 files changed
+634
-25
No files matched your search
@@ -0,0 +1,33 @@
|
||||
using RpcComponents;
|
||||
using Unity.Burst;
|
||||
using Unity.Collections;
|
||||
using Unity.Entities;
|
||||
using Unity.NetCode;
|
||||
|
||||
partial struct InitializeLocallySystem : ISystem
|
||||
{
|
||||
[BurstCompile]
|
||||
public void OnCreate(ref SystemState state)
|
||||
{
|
||||
var builder = new EntityQueryBuilder(Allocator.Temp).WithAll<GhostOwnerIsLocal>().WithNone<InitializedLocallyTag>();
|
||||
state.RequireForUpdate(state.GetEntityQuery(builder));
|
||||
}
|
||||
|
||||
[BurstCompile]
|
||||
public void OnUpdate(ref SystemState state)
|
||||
{
|
||||
EntityCommandBuffer ecb = SystemAPI.GetSingletonRW<EndSimulationEntityCommandBufferSystem.Singleton>().ValueRW.CreateCommandBuffer(state.WorldUnmanaged);
|
||||
|
||||
foreach (var (character, entity) in SystemAPI.Query<FirstPersonCharacterComponent>().WithAll<GhostOwnerIsLocal>().WithNone<InitializedLocallyTag>().WithEntityAccess())
|
||||
{
|
||||
ecb.AddComponent(character.ViewEntity, new MainEntityCamera());
|
||||
ecb.AddComponent(entity, new InitializedLocallyTag());
|
||||
}
|
||||
}
|
||||
|
||||
[BurstCompile]
|
||||
public void OnDestroy(ref SystemState state)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1b3232746997cb344a18d3986cc1e107
|
||||
@@ -0,0 +1,6 @@
|
||||
using Unity.Entities;
|
||||
|
||||
public struct InitializedLocallyTag : IComponentData
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fe8481b72fe69a249ab201f73028655f
|
||||
Reference in new issue
Block a user