Progress character customization
This commit is contained in:
1 parent
bf545f3baf
commit
5708c0bbbd
20 files changed
+327
-191
No files matched your search
@@ -1,4 +1,6 @@
|
||||
using System.Linq.Expressions;
|
||||
using Unity.Entities;
|
||||
using Unity.Rendering;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Common
|
||||
@@ -13,6 +15,8 @@ namespace Common
|
||||
AddComponent<CharacterTag>(entity);
|
||||
AddComponent<NewCharacterTag>(entity);
|
||||
AddComponent<TdTeam>(entity);
|
||||
|
||||
AddComponent<CharacterConfig>(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
using Unity.Entities;
|
||||
using Unity.NetCode;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Common
|
||||
{
|
||||
public struct CharacterTag : IComponentData
|
||||
{
|
||||
|
||||
}
|
||||
public struct CharacterTag : IComponentData { }
|
||||
|
||||
public struct NewCharacterTag : IComponentData
|
||||
public struct NewCharacterTag : IComponentData { }
|
||||
|
||||
public struct CharacterConfig : IComponentData
|
||||
{
|
||||
|
||||
[GhostField] public Color Color;
|
||||
}
|
||||
|
||||
public struct TdTeam : IComponentData
|
||||
|
||||
@@ -1,23 +1,43 @@
|
||||
using Unity.Burst;
|
||||
using Unity.Collections;
|
||||
using Unity.Entities;
|
||||
using Unity.Mathematics;
|
||||
using Unity.Physics;
|
||||
using Unity.Rendering;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
|
||||
partial struct InitializeCharacterSystem : ISystem
|
||||
namespace Common
|
||||
{
|
||||
[BurstCompile]
|
||||
public void OnCreate(ref SystemState state)
|
||||
[UpdateInGroup(typeof(SimulationSystemGroup), OrderFirst = true)]
|
||||
[WorldSystemFilter(WorldSystemFilterFlags.ServerSimulation | WorldSystemFilterFlags.ClientSimulation)]
|
||||
public partial struct InitializeCharacterSystem : ISystem
|
||||
{
|
||||
|
||||
}
|
||||
public void OnCreate(ref SystemState state)
|
||||
{
|
||||
}
|
||||
|
||||
[BurstCompile]
|
||||
public void OnUpdate(ref SystemState state)
|
||||
{
|
||||
|
||||
}
|
||||
public void OnUpdate(ref SystemState state)
|
||||
{
|
||||
var ecb = new EntityCommandBuffer(Allocator.Temp);
|
||||
foreach (var (physicsMass, config, newCharacterEntity) in SystemAPI.Query<RefRW<PhysicsMass>, RefRO<CharacterConfig>>().WithAny<NewCharacterTag>().WithEntityAccess())
|
||||
{
|
||||
physicsMass.ValueRW.InverseInertia[0] = 0;
|
||||
physicsMass.ValueRW.InverseInertia[1] = 0;
|
||||
physicsMass.ValueRW.InverseInertia[2] = 0;
|
||||
|
||||
[BurstCompile]
|
||||
public void OnDestroy(ref SystemState state)
|
||||
{
|
||||
var requestedColor = config.ValueRO.Color;
|
||||
var color = new float4(requestedColor.r, requestedColor.g, requestedColor.b, requestedColor.a);
|
||||
ecb.AddComponent(newCharacterEntity, new URPMaterialPropertyBaseColor{Value = color});
|
||||
ecb.RemoveComponent<NewCharacterTag>(newCharacterEntity);
|
||||
}
|
||||
|
||||
ecb.Playback(state.EntityManager);
|
||||
}
|
||||
|
||||
public void OnDestroy(ref SystemState state)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ using UnityEngine;
|
||||
|
||||
namespace Common
|
||||
{
|
||||
class TDPrefabsAuthoring : MonoBehaviour
|
||||
public class TDPrefabsAuthoring : MonoBehaviour
|
||||
{
|
||||
// public GameObject PrefabController;
|
||||
public GameObject PrefabCharacter;
|
||||
|
||||
Reference in new issue
Block a user