Initial Commit
This commit is contained in:
commit
ee5c2f922d
2255 changed files with 547750 additions and 0 deletions
45
Assets/Scripts/Systems/Enemy/EnemyInitializationSystem.cs
Normal file
45
Assets/Scripts/Systems/Enemy/EnemyInitializationSystem.cs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
using AI;
|
||||
using Unity.Entities;
|
||||
|
||||
namespace DefaultNamespace
|
||||
{
|
||||
[UpdateInGroup(typeof(InitializationSystemGroup))]
|
||||
public class EnemyInitializationSystem : ComponentSystem
|
||||
{
|
||||
protected override void OnUpdate()
|
||||
{
|
||||
Entities.WithAll<EnemyPrefabComponent>()
|
||||
.WithNone<EnemyActorGoapInitialized>()
|
||||
.ForEach(
|
||||
(Entity entity, GoapAgentData data) =>
|
||||
{
|
||||
data.Goals.Add(((int)GoapKeys.Attacks, true));
|
||||
|
||||
PostUpdateCommands.AddComponent(entity, new EnemyActorGoapInitialized());
|
||||
});
|
||||
|
||||
Entities.WithNone<ActorGrenadeData>()
|
||||
.ForEach((Entity entitiy, ActorGrenadeComponent grenade) => { PostUpdateCommands.AddComponent(entitiy, new ActorGrenadeData()); });
|
||||
|
||||
Entities.WithNone<ActorData, ActorDataInitialization>()
|
||||
.ForEach(
|
||||
(Entity entity, EnemyPrefabComponent prefab) =>
|
||||
{
|
||||
prefab.Prefab.OperationHandle.Convert<EnemyPrefab>().Completed += operation =>
|
||||
{
|
||||
EntityManager.AddComponentData(entity, new ActorData { Health = operation.Result.MaxHealth });
|
||||
EntityManager.RemoveComponent<ActorDataInitialization>(entity);
|
||||
};
|
||||
PostUpdateCommands.AddComponent(entity, new ActorDataInitialization());
|
||||
});
|
||||
}
|
||||
|
||||
private struct ActorDataInitialization : ISystemStateComponentData
|
||||
{
|
||||
}
|
||||
|
||||
private struct EnemyActorGoapInitialized : IComponentData
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue