Пример #1
0
        void Retarget()
        {
            TargetGatheringManager manager = GetLogicWorld().GetTargetGatheringManager();

            manager.BuildTargetList(GetOwnerEntity(), m_target_gathering_param, m_targets);
            if (m_targets.Count == 0)
            {
                return;
            }
            Entity new_enemy = m_targets[0].GetEntity(GetLogicWorld());

            ClearTargets();
            if (new_enemy == m_current_enemy)
            {
                return;
            }
            if (m_current_enemy != null)
            {
                m_current_enemy.RemoveListener(SignalType.Die, m_listener_context.ID);
                m_current_enemy = null;
            }
            m_current_enemy = new_enemy;
            m_current_enemy.AddListener(SignalType.Die, m_listener_context);
            m_targeting_component.StartTargeting(m_current_enemy);
        }
Пример #2
0
 public void BuildSkillTargets()
 {
     ClearTargets();
     if (m_definition_component.m_target_gathering_param.m_type == TargetGatheringType.SpecifiedTarget)
     {
         if (m_definition_component.ExternalDataType == SkillDefinitionComponent.NeedExternalTarget)
         {
             int specified_target_id = m_definition_component.ExternalID;
             if (specified_target_id > 0)
             {
                 Target target = RecyclableObject.Create <Target>();
                 target.Construct();
                 target.SetEntityTarget(specified_target_id);
                 m_skill_targets.Add(target);
             }
         }
         else if (m_definition_component.ExternalDataType == SkillDefinitionComponent.NeedExternalOffset)
         {
             PositionComponent position_component = GetOwnerEntity().GetComponent(PositionComponent.ID) as PositionComponent;
             Target            target             = RecyclableObject.Create <Target>();
             target.Construct();
             target.SetPositionTarget(position_component.CurrentPosition + m_definition_component.ExternalVector);
             m_skill_targets.Add(target);
         }
     }
     else
     {
         TargetGatheringManager target_gathering_manager = GetLogicWorld().GetTargetGatheringManager();
         target_gathering_manager.BuildTargetList(GetOwnerEntity(), m_definition_component.m_target_gathering_param, m_skill_targets);
     }
 }
Пример #3
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);
        }
        public void OnUpdate()
        {
            if (!m_active)
            {
                return;
            }
            TargetGatheringManager target_gathering_manager = m_manager.GetLogicWorld().GetTargetGatheringManager();

            if (target_gathering_manager == null)
            {
                return;
            }
            if (m_binding_object != null)
            {
                target_gathering_manager.BuildTargetList(m_binding_object, m_target_gathering_param, m_current_entered_entities);
            }
            else
            {
                target_gathering_manager.BuildTargetList(m_partition, null, m_fixed_position, m_fixed_facing, m_target_gathering_param, m_current_entered_entities);
            }
            for (int i = 0; i < m_previous_entered_entities.Count; ++i)
            {
                if (!m_current_entered_entities.Contains(m_previous_entered_entities[i]))
                {
                    m_callback.OnEntityExit(m_previous_entered_entities[i]);
                }
            }
            for (int i = 0; i < m_current_entered_entities.Count; ++i)
            {
                if (!m_previous_entered_entities.Contains(m_current_entered_entities[i]))
                {
                    m_callback.OnEntityEnter(m_current_entered_entities[i]);
                }
            }
            List <int> temp = m_previous_entered_entities;

            m_previous_entered_entities = m_current_entered_entities;
            m_current_entered_entities  = temp;
            m_current_entered_entities.Clear();
        }
Пример #5
0
        protected override void OnActionUpdate(FixPoint delta_time)
        {
            TargetGatheringManager target_gathering_manager = GetLogicWorld().GetTargetGatheringManager();

            target_gathering_manager.BuildTargetList(GetOwnerEntity(), m_target_gathering_param, m_targets);
            int current_target_id = 0;

            if (m_targets.Count > 0)
            {
                current_target_id = m_targets[0].GetEntityID();
                m_status          = BTNodeStatus.True;
            }
            else
            {
                m_status = BTNodeStatus.False;
            }
            m_context.SetData(BTContextKey.CurrentTargetID, (FixPoint)current_target_id);
            ClearTargets();
        }