add FindEntityByName function
This commit is contained in:
@ -8,19 +8,25 @@ namespace Sandbox {
|
||||
// private TransformComponent m_Transform;
|
||||
// private RigidBody2DComponent m_Rigidbody;
|
||||
|
||||
public float MoveSpeed;
|
||||
/*
|
||||
public float MoveSpeed;
|
||||
public float DistanceFromPlayer = 5;
|
||||
|
||||
private Entity m_Player;
|
||||
|
||||
void OnCreate()
|
||||
{
|
||||
Console.WriteLine($"Player.OnCreate - {ID}");
|
||||
Console.WriteLine($"Camera.OnCreate - {ID}");
|
||||
|
||||
m_Transform = GetComponent<TransformComponent>();
|
||||
m_Rigidbody = GetComponent<RigidBody2DComponent>();
|
||||
m_Player = FindEntityByName("Player");
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
void OnUpdate(float ts)
|
||||
{
|
||||
if(m_Player != null)
|
||||
{
|
||||
Translation = new Vector3(m_Player.Translation.XY, DistanceFromPlayer);
|
||||
}
|
||||
// Console.WriteLine($"Player.OnUpdate: {ts}");
|
||||
|
||||
float speed = MoveSpeed;
|
||||
|
||||
Reference in New Issue
Block a user