mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-06 05:01:53 +00:00
2D Physics
This commit is contained in:
@@ -63,6 +63,8 @@ namespace GlitchyEngine.World
|
||||
}
|
||||
}
|
||||
|
||||
public TransformComponent* Transform => GetComponent<TransformComponent>();
|
||||
|
||||
public T* AddComponent<T>(T value = T()) where T: struct, new
|
||||
{
|
||||
Log.EngineLogger.AssertDebug(!HasComponent<T>(), scope $"Entity already has component.");
|
||||
@@ -85,6 +87,18 @@ namespace GlitchyEngine.World
|
||||
{
|
||||
return _scene._ecsWorld.HasComponent<T>(_entity);
|
||||
}
|
||||
|
||||
public bool TryGetComponent<T>(out T* component) where T: struct, new
|
||||
{
|
||||
if (HasComponent<T>())
|
||||
{
|
||||
component = GetComponent<T>();
|
||||
return true;
|
||||
}
|
||||
|
||||
component = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
public void RemoveComponent<T>() where T: struct, new
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user