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

namespace KavTest.Spawners
{
    public class RustyBallSpawner : Spawner<RustyBallSpawnMessage>
    {
        private Model RustyBallModel { get; }

        public RustyBallSpawner(Model rustyBallModel)
        {
            RustyBallModel = rustyBallModel;
        }

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

            AddComponent(entity, new Transform3DComponent(message.Transform));
            AddComponent(entity, new ModelComponent(RustyBallModel));
            AddComponent(entity, new AngularVelocityComponent(message.AngularVelocity));
        }
    }
}
