Files
cryptonhym-thunder/Code/Presenters/TransformPresenterComponent.cs

31 lines
758 B
C#

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)
{
}
}