1
This commit is contained in:
@@ -4,13 +4,16 @@
|
||||
{
|
||||
public static void Map<T>(T source, T target) where T : class
|
||||
{
|
||||
foreach (var info in typeof(T).GetProperties())
|
||||
foreach (var info in source.GetType().GetProperties(ReflectionHelper.Flags))
|
||||
{
|
||||
info.SetValue(source, info.GetValue(target));
|
||||
if (info.CanWrite is false) continue;
|
||||
var targetInfo = target.GetType().GetProperty(info.Name, ReflectionHelper.Flags);
|
||||
targetInfo?.SetValue(target, info.GetValue(source));
|
||||
}
|
||||
foreach (var info in typeof(T).GetFields())
|
||||
foreach (var info in source.GetType().GetFields(ReflectionHelper.Flags))
|
||||
{
|
||||
info.SetValue(source, info.GetValue(target));
|
||||
var targetInfo = target.GetType().GetField(info.Name, ReflectionHelper.Flags);
|
||||
targetInfo?.SetValue(target, info.GetValue(source));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
14
Src/Core/ECS/Built-In/IdComponent.cs
Normal file
14
Src/Core/ECS/Built-In/IdComponent.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System.Dynamic;
|
||||
|
||||
namespace BITKit.Entities
|
||||
{
|
||||
public interface IdComponent
|
||||
{
|
||||
ulong Id { get; set; }
|
||||
}
|
||||
public interface IdComponent_String
|
||||
{
|
||||
string Id { get; }
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user