コード例 #1
0
ファイル: LogicWorld.cs プロジェクト: mengflyQ/GameFrameWork
 public virtual void Destruct()
 {
     m_paitition.Destruct();
     m_paitition = null;
     m_graph.Destruct();
     m_graph = null;
 }
コード例 #2
0
 public void Construct(IRegionCallback callback, ISpacePartition partition, Vector3FP fixed_position)
 {
     m_callback       = callback;
     m_binding_object = null;
     m_partition      = partition;
     m_fixed_position = fixed_position;
 }
コード例 #3
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();
 }
コード例 #4
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);
            }
        }
コード例 #5
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();
 }
コード例 #6
0
        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);
        }
コード例 #7
0
        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;
        }