using Encompass;
using Kav;
using KavTest.Components;
using KavTest.Messages;

namespace KavTest.Spawners
{
    public class LightBulbSpawner : Spawner<LightBulbSpawnMessage>
    {
        public Model LightBulbModel { get; }
        
        public LightBulbSpawner(Model lightBulbModel)
        {
            LightBulbModel = lightBulbModel;
        }

        protected override void Spawn(in LightBulbSpawnMessage message)
        {
            var entity = CreateEntity();

            AddComponent(entity, new Transform3DComponent(message.Transform));
            AddComponent(entity, new PointLightComponent(message.Color, message.Intensity));
            AddComponent(entity, new MoveAlongCurve3DComponent(message.Curve));
            //AddComponent(entity, new ModelComponent(LightBulbModel));
            AddComponent(entity, new OverrideAlbedoComponent(message.Color.ToVector3()));
        }
    }
}
