Add initial resource and presenter classes for game entities and effects
This commit is contained in:
31
Code/Presenters/TransformPresenterComponent.cs
Normal file
31
Code/Presenters/TransformPresenterComponent.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using CryptonymThunder.Code.Extensions;
|
||||
using GameCore.ECS;
|
||||
using GameCore.ECS.Interfaces;
|
||||
using GameCore.Physics;
|
||||
using Godot;
|
||||
|
||||
namespace CryptonymThunder.Code.Presenters;
|
||||
|
||||
[GlobalClass]
|
||||
public partial class TransformPresenterComponent : Node3D, IPresenterComponent, IEntityPresenter
|
||||
{
|
||||
private PositionComponent _position;
|
||||
|
||||
public Entity CoreEntity { get; set; }
|
||||
|
||||
public void Initialize(Entity coreEntity, World world)
|
||||
{
|
||||
CoreEntity = coreEntity;
|
||||
_position = world.GetComponent<PositionComponent>(coreEntity);
|
||||
}
|
||||
|
||||
public void SyncToPresentation(float delta)
|
||||
{
|
||||
if (_position != null) GlobalPosition = _position.Position.ToGodot();
|
||||
}
|
||||
|
||||
public void SyncToCore(float delta)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user