This commit is contained in:
CortexCore
2024-03-31 23:31:00 +08:00
parent e179d2eb53
commit b7b89ee71a
641 changed files with 31286 additions and 22134 deletions

View File

@@ -13,19 +13,16 @@ namespace BITKit.Scene
[SerializeField] private IEntitiesService _entitiesService;
[SerializeField] private CinemachineTargetGroup targetGroup;
[SerializeField] private Optional<Entity[]> initialEntities;
[SerializeField] private bool removeOnEliminate;
private void Update()
{
// foreach (var x in initialEntities.IfNotAllow(()=>_entitiesService.Query<IHealth>().Cast<Entity>().ToArray()))
// {
//
// }
targetGroup.m_Targets =
initialEntities.IfNotAllow(() => _entitiesService.Query<IHealth>().Cast<Entity>().ToArray())
.Select(x => new CinemachineTargetGroup.Target()
{
target = x.transform,
radius = 1,
weight = x.TryGetComponent<IHealth>(out var heal) ? heal.IsAlive ? 1 : 0 : 0
weight =removeOnEliminate ? x.TryGetComponent<IHealth>(out var heal) ? heal.IsAlive ? 1 : 0 : 0 : 1
})
.ToArray();
if (targetGroup.m_Targets.Length is 0)