30 lines
648 B
C#
30 lines
648 B
C#
using Prism;
|
|
|
|
namespace Example
|
|
{
|
|
public class BasicController : Entity
|
|
{
|
|
public float Speed;
|
|
|
|
private Entity m_PlayerEntity;
|
|
|
|
public void OnCreate()
|
|
{
|
|
m_PlayerEntity = FindEntityByTag("Player");
|
|
}
|
|
|
|
public void OnUpdate(float ts)
|
|
{
|
|
Mat4 transform = GetTransform();
|
|
|
|
Vec3 translation = transform.Translation;
|
|
translation.XY = m_PlayerEntity.GetTransform().Translation.XY;
|
|
translation.Y = Math.Max(translation.Y, 4.5f);
|
|
transform.Translation = translation;
|
|
SetTransform(transform);
|
|
}
|
|
|
|
|
|
}
|
|
}
|