示例#1
0
        public void BuildSkillTargets(TargetGatheringParam target_gathering_param)
        {
            ClearTargets();
            TargetGatheringManager target_gathering_manager = GetLogicWorld().GetTargetGatheringManager();

            target_gathering_manager.BuildTargetList(GetOwnerEntity(), target_gathering_param, m_skill_targets);
        }
示例#2
0
 public void CopyFrom(TargetGatheringParam rhs)
 {
     m_type           = rhs.m_type;
     m_param1         = rhs.m_param1;
     m_param2         = rhs.m_param2;
     m_faction        = rhs.m_faction;
     m_category       = rhs.m_category;
     m_sorting_method = rhs.m_sorting_method;
     m_max_count      = rhs.m_max_count;
 }
示例#3
0
 protected override void PostInitializeComponent()
 {
     m_target_gathering_param           = new TargetGatheringParam();
     m_target_gathering_param.m_type    = TargetGatheringType.SurroundingRing;
     m_target_gathering_param.m_param1  = m_guard_range;
     m_target_gathering_param.m_faction = FactionRelation.Enemy;
     m_targeting_component = ParentObject.GetComponent(TargetingComponent.ID) as TargetingComponent;
     if (m_targeting_component == null)
     {
         return;
     }
     m_listener_context = SignalListenerContext.CreateForEntityComponent(GetLogicWorld().GenerateSignalListenerID(), ParentObject.ID, m_component_type_id);
     Schedule();
 }
        public void Reset()
        {
            m_manager = null;
            m_id      = 0;

            m_callback       = null;
            m_binding_object = null;
            m_fixed_position.MakeZero();
            m_fixed_facing.MakeZero();
            m_target_gathering_param = null;

            m_active = false;
            m_previous_entered_entities.Clear();
            m_current_entered_entities.Clear();
        }
示例#5
0
 public void BuildTargetList(Entity source_entity, TargetGatheringParam param, List <int> targets)
 {
     m_temp_targets.Clear();
     if (GatherEntitySpecial(source_entity, param, m_temp_targets))
     {
     }
     else
     {
         PositionComponent position_cmp = source_entity.GetComponent(PositionComponent.ID) as PositionComponent;
         if (position_cmp == null)
         {
             return;
         }
         GatherGeneral(position_cmp.GetSpacePartition(), source_entity.GetOwnerPlayer(), position_cmp.CurrentPosition, position_cmp.Facing2D, param, m_temp_targets);
     }
     for (int i = 0; i < m_temp_targets.Count; ++i)
     {
         targets.Add(m_temp_targets[i].ID);
     }
     m_temp_targets.Clear();
 }
示例#6
0
 public void BuildTargetList(Entity source_entity, TargetGatheringParam param, List <Target> targets)
 {
     m_temp_targets.Clear();
     if (GatherEntitySpecial(source_entity, param, m_temp_targets))
     {
     }
     else
     {
         PositionComponent position_cmp = source_entity.GetComponent(PositionComponent.ID) as PositionComponent;
         if (position_cmp == null)
         {
             return;
         }
         GatherGeneral(position_cmp.GetSpacePartition(), source_entity.GetOwnerPlayer(), position_cmp.CurrentPosition, position_cmp.Facing2D, param, m_temp_targets);
     }
     for (int i = 0; i < m_temp_targets.Count; ++i)
     {
         Target target = RecyclableObject.Create <Target>();
         target.Construct();
         target.SetEntityTarget(m_temp_targets[i]);
         targets.Add(target);
     }
     m_temp_targets.Clear();
 }
示例#7
0
        bool GatherEntitySpecial(Entity source_entity, TargetGatheringParam param, List <Entity> targets)
        {
            int gathering_type = param.m_type;

            if (gathering_type == TargetGatheringType.Default)
            {
                TargetingComponent targeting_component = source_entity.GetComponent(TargetingComponent.ID) as TargetingComponent;
                if (targeting_component != null)
                {
                    Entity entity = targeting_component.GetCurrentTarget();
                    if (entity != null)
                    {
                        targets.Add(entity);
                    }
                }
                return(true);
            }
            else if (gathering_type == TargetGatheringType.Source)
            {
                targets.Add(source_entity);
                return(true);
            }
            return(false);
        }
        //public bool m_bidirectional_lookup = false;

        public EffectGeneratorEntryData()
        {
            m_target_gathering_param           = new TargetGatheringParam();
            m_target_gathering_param.m_faction = FactionRelation.All;
        }
示例#9
0
        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);
            }
        }
示例#10
0
 public void BuildTargetList(ISpacePartition partition, Player player, Vector3FP position, Vector2FP facing, TargetGatheringParam param, List <int> targets)
 {
     m_temp_targets.Clear();
     GatherGeneral(partition, player, position, facing, param, m_temp_targets);
     for (int i = 0; i < m_temp_targets.Count; ++i)
     {
         targets.Add(m_temp_targets[i].ID);
     }
     m_temp_targets.Clear();
 }
示例#11
0
 public void BuildTargetList(ISpacePartition partition, Player player, Vector3FP position, Vector2FP facing, TargetGatheringParam param, List <Target> targets)
 {
     m_temp_targets.Clear();
     GatherGeneral(partition, player, position, facing, param, m_temp_targets);
     for (int i = 0; i < m_temp_targets.Count; ++i)
     {
         Target target = RecyclableObject.Create <Target>();
         target.Construct();
         target.SetEntityTarget(m_temp_targets[i]);
         targets.Add(target);
     }
     m_temp_targets.Clear();
 }
 public void SetTargetGatheringParam(TargetGatheringParam param)
 {
     m_target_gathering_param = param;
 }