using Cysharp.Threading.Tasks; namespace DanieleMarotta.RiversongCodeShowcase { public class FireProjectileExecutionLogic : IntentExecutionLogic { private IEntityCollection _entityCollection; private IProjectileManager _projectileManager; public override UniTask InitializeAsync(IServiceLocator serviceLocator) { _entityCollection = serviceLocator.GetService(); _projectileManager = serviceLocator.GetService(); return UniTask.CompletedTask; } public override IntentExecutionResult Execute(Agent agent, in AgentIntent intent) { var critter = _entityCollection.Get(intent.TargetId); _projectileManager.FireProjectile(agent, critter); return IntentExecutionResult.Success; } } }