using Encompass;
using KavTest.Components;
using KavTest.Messages;
using Microsoft.Xna.Framework;

namespace KavTest.Spawners
{
    public class DirectionalLightSpawner : Spawner<DirectionalLightSpawnMessage>
    {
        protected override void Spawn(in DirectionalLightSpawnMessage message)
        {
            var entity = CreateEntity();

            AddComponent(entity, new Transform3DComponent(new Transform3D(Vector3.Zero, message.Orientation)));
            AddComponent(entity, new DirectionalLightComponent(message.Color, message.Intensity));
            var forward = Matrix.CreateFromQuaternion(message.Orientation).Forward;
            AddComponent(entity, new ContinuousRotationComponent(forward, 0.01f));
        }
    }
}
