riversong code showcase
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
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<IEntityCollection>();
|
||||
_projectileManager = serviceLocator.GetService<IProjectileManager>();
|
||||
|
||||
return UniTask.CompletedTask;
|
||||
}
|
||||
|
||||
public override IntentExecutionResult Execute(Agent agent, in AgentIntent intent)
|
||||
{
|
||||
var critter = _entityCollection.Get<Agent>(intent.TargetId);
|
||||
_projectileManager.FireProjectile(agent, critter);
|
||||
return IntentExecutionResult.Success;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user