void GatherGeneral(ISpacePartition partition, Player player, Vector3FP position, Vector2FP facing, TargetGatheringParam param, List <Entity> targets) { if (partition == null) { return; } List <PositionComponent> list = null; int gathering_type = param.m_type; if (gathering_type == TargetGatheringType.ForwardRectangle) { list = partition.CollectEntity_ForwardRectangle(position, facing, param.m_param1, param.m_param2); } else if (gathering_type == TargetGatheringType.SurroundingRing) { list = partition.CollectEntity_SurroundingRing(position, param.m_param1, param.m_param2); } else if (gathering_type == TargetGatheringType.ForwardSector) { list = partition.CollectEntity_ForwardSector(position, facing, param.m_param1, param.m_param2); } else if (gathering_type == TargetGatheringType.All) { list = partition.CollectEntity_All(); } if (list == null) { return; } for (int i = 0; i < list.Count; ++i) { PositionComponent position_component = list[i]; Entity entity = position_component.GetOwnerEntity(); if (param.m_category != 0) { EntityDefinitionComponent definition_component = entity.GetComponent(EntityDefinitionComponent.ID) as EntityDefinitionComponent; if (definition_component == null) { continue; } if (!definition_component.IsCategory(param.m_category)) { continue; } } if (player != null && !FactionRelation.IsFactionSatisfied(player.GetFaction(entity.GetOwnerPlayerID()), param.m_faction)) { continue; } targets.Add(entity); } }
bool DetectCollision(ISpacePartition partition, Vector3FP position, FixPoint radius) { if (partition == null) { return(false); } List <PositionComponent> list = partition.CollectEntity_SurroundingRing(position, radius, FixPoint.Zero, m_param.m_source_entity_id); if (list.Count == 0) { return(false); } for (int i = 0; i < list.Count; ++i) { PositionComponent position_component = list[i]; Entity entity = position_component.GetOwnerEntity(); if (m_pierce_entity) { if (m_effected_entities.Contains(entity.ID)) { continue; } else { m_effected_entities.Add(entity.ID); } } if (position_component.Height <= FixPoint.Zero) //ZZWTODO { continue; } if (!FactionRelation.IsFactionSatisfied(GetOwnerPlayer().GetFaction(entity.GetOwnerPlayerID()), m_collision_faction)) { continue; } Explode(entity); if (!m_pierce_entity) { return(true); } } return(false); }
void DetectCollision(ISpacePartition partition, Vector3FP position, FixPoint radius) { if (partition == null) { return; } SkillComponent skill_component = m_context.GetData <SkillComponent>(BTContextKey.OwnerSkillComponent); Skill skill = skill_component.GetOwnerSkill(); List <PositionComponent> list = partition.CollectEntity_SurroundingRing(position, radius, FixPoint.Zero, skill.GetOwnerEntityID()); if (list.Count == 0) { return; } for (int i = 0; i < list.Count; ++i) { PositionComponent position_component = list[i]; Entity entity = position_component.GetOwnerEntity(); if (m_collided_targets.Contains(entity.ID)) { continue; } m_collided_targets.Add(entity.ID); if (position_component.Height <= FixPoint.Zero) //ZZWTODO { continue; } if (!FactionRelation.IsFactionSatisfied(skill.GetOwnerPlayer().GetFaction(entity.GetOwnerPlayerID()), FactionRelation.NotAlly)) { continue; } Entity current_target = entity; skill_component.CurrentTarget = current_target; EffectApplicationData app_data = RecyclableObject.Create <EffectApplicationData>(); app_data.m_original_entity_id = skill.GetOwnerEntityID(); app_data.m_source_entity_id = app_data.m_original_entity_id; m_collision_target_generator.Activate(app_data, entity); RecyclableObject.Recycle(app_data); } skill_component.CurrentTarget = null; }