EntityController.cs
using Sandbox;
public sealed class EntityController : Component
{
[Property]
public RedLightGreenLight GameController { get; set; }
protected override void OnUpdate()
{
if ( GameController.State == RedLightGreenLight.GameState.Red)
{
GameObject.Transform.Rotation = Rotation.FromYaw(180f);
Log.Info("entity red");
}
else
{
GameObject.Transform.Rotation = Rotation.FromYaw(0f);
Log.Info("entity green");
}
}
[Button]
public void Rotate()
{
GameObject.Transform.Rotation = Rotation.FromYaw(0f);
}
}