public override List <ActorObj> GetActorsInRange(AoeObj aoeObj) { List <ActorObj> result = new List <ActorObj>(); int uid = aoeObj.ower.EntityId; ActorObj actor = MapLocate.Map.GetActor(uid); Entity selfEntity = ECSLocate.ECS.GetEntity(uid); CampCom selfCampCom = selfEntity.GetCom <CampCom>(); Shape checkShape = aoeObj.CalcArea(); //Ïȼì²âÍæ¼Ò Entity playerEntity = LCECS.ECSLocate.Player.GetPlayerEntity(); CampCom playerCampCom = playerEntity.GetCom <CampCom>(); if (playerEntity != null && playerEntity.Uid != uid && playerCampCom.Camp != selfCampCom.Camp) { Shape playerBody = EntityGetter.GetEntityColliderShape(playerEntity); if (checkShape.Intersects(playerBody)) { result.Add(MapLocate.Map.PlayerActor); } } //µÐ¶ÔÑÝÔ± foreach (var item in actor.Area.Actors) { if (item.Key == aoeObj.ower.EntityId) { continue; } Entity entity = ECSLocate.ECS.GetEntity(item.Key); if (entity != null) { CampCom campCom = entity.GetCom <CampCom>(); if (campCom != null && campCom.Camp != selfCampCom.Camp) { Shape body = EntityGetter.GetEntityColliderShape(entity); if (checkShape.Intersects(body)) { result.Add(item.Value); } } } } return(result); }
public override bool OnMakeTrue(NodeData wData) { EntityWorkData workData = wData as EntityWorkData; TransformCom selfTransCom = workData.MEntity.GetCom <TransformCom>(); ActorObj actor = MapLocate.Map.GetActor(workData.MEntity.Uid); CampCom selfCampCom = workData.MEntity.GetCom <CampCom>(); if (actor == null || actor.Area == null) { return(false); } if (selfCampCom == null || selfCampCom.Camp == CampType.Neutral) { return(false); } Shape checkShape = checkRange; checkShape.Translate(selfTransCom.GetPos()); GameLocate.ShapeRender.AddShape(ShapeRenderType.攻击范围, workData.MEntity.Uid, checkShape); //检测保存的 if (wData.Blackboard.ContainsKey(EnemyInAttackRangeKey)) { int saveEntityId = (int)wData.Blackboard[EnemyInAttackRangeKey]; Entity saveEntity = LCECS.ECSLocate.ECS.GetEntity(saveEntityId); if (saveEntity == null) { wData.Blackboard.Remove(EnemyInAttackRangeKey); } Shape saveShape = GetEntityColliderShape(saveEntity); if (!saveShape.Intersects(checkShape)) { wData.Blackboard.Remove(EnemyInAttackRangeKey); } else { return(true); } } //先检测玩家 Entity playerEntity = LCECS.ECSLocate.Player.GetPlayerEntity(); if (playerEntity != null) { TransformCom transCom = playerEntity.GetCom <TransformCom>(); if (checkShape.ContainPoint(transCom.GetPos())) { wData.Blackboard.Add(EnemyInAttackRangeKey, playerEntity.Uid); return(true); } } //敌对演员 foreach (var item in actor.Area.Actors.Keys) { if (item == workData.MEntity.Uid) { continue; } Entity entity = LCECS.ECSLocate.ECS.GetEntity(item); if (entity != null) { CampCom campCom = entity.GetCom <CampCom>(); if (campCom != null && campCom.Camp != selfCampCom.Camp) { TransformCom transCom = entity.GetCom <TransformCom>(); if (checkShape.ContainPoint(transCom.GetPos())) { wData.Blackboard.Add(EnemyInAttackRangeKey, entity.Uid); return(true); } } } } return(false); }