public bool Run(int entrty_id = 0)
        {
            int new_index = EntryID2Index(entrty_id);

            if (new_index == -1)
            {
                return(false);
            }
            if (new_index == m_current_running_entry_index)
            {
                return(true);
            }
            m_context.GetActionBuffer().ExitAllAction();
            if (m_current_running_entry_index >= 0)
            {
                m_children[m_current_running_entry_index].ClearRunningTrace();
            }
            m_current_running_entry_index = new_index;
            m_task.Cancel();
            FixPoint update_interval = UpdateInterval;

            if (update_interval > FixPoint.Zero)
            {
                LogicWorld logic_world = m_context.GetLogicWorld();
                var        schedeler   = logic_world.GetTaskScheduler();
                schedeler.Schedule(m_task, logic_world.GetCurrentTime(), update_interval, update_interval);
            }
            OnUpdate(FixPoint.Zero);
            return(true);
        }
        public void KillOwner(int killer_id)
        {
            //ZZWTODO Resurrect

            if (m_die_task != null)
            {
                m_die_task.Cancel();
            }
            LogicWorld logic_world = GetLogicWorld();

            Entity killer = logic_world.GetEntityManager().GetObject(killer_id);

            if (!DieSilently && killer_id != ParentObject.ID && m_killer_generator != null && killer != null)
            {
                EffectApplicationData app_data = RecyclableObject.Create <EffectApplicationData>();
                app_data.m_original_entity_id = ParentObject.ID;
                app_data.m_source_entity_id   = ParentObject.ID;
                m_killer_generator.Activate(app_data, killer);
                RecyclableObject.Recycle(app_data);
            }

            var schedeler = logic_world.GetTaskScheduler();

            if (DieSilently)
            {
                logic_world.AddSimpleRenderMessage(RenderMessageType.Hide, ParentObject.ID);
            }
            else
            {
                HideEntityTask hide_task = LogicTask.Create <HideEntityTask>();
                hide_task.Construct(ParentObject.ID);
                schedeler.Schedule(hide_task, GetCurrentTime(), m_hide_delay);
            }

            ParentObject.DeletePending = true;
            ParentObject.SendSignal(SignalType.Die);
            logic_world.AddSimpleRenderMessage(RenderMessageType.Die, ParentObject.ID);

            StateComponent state_component = ParentObject.GetComponent(StateComponent.ID) as StateComponent;

            if (state_component != null)
            {
                state_component.AddState(StateSystem.DEAD_STATE, 0);
            }

            if (!m_can_resurrect)
            {
                DeleteEntityTask delete_task = LogicTask.Create <DeleteEntityTask>();
                delete_task.Construct(ParentObject.ID);
                schedeler.Schedule(delete_task, GetCurrentTime(), m_delete_delay);
            }

            logic_world.OnKillEntity(killer, GetOwnerEntity());
        }
        public void ScheduleTargeting(FixPoint delay)
        {
            if (m_task == null)
            {
                m_task = LogicTask.Create <ComponentCommonTask>();
                m_task.Construct(this);
            }
            LogicWorld logic_world    = GetLogicWorld();
            var        task_scheduler = logic_world.GetTaskScheduler();

            task_scheduler.Schedule(m_task, logic_world.GetCurrentTime(), delay);
        }
Exemple #4
0
        protected override void OnActionUpdate(FixPoint delta_time)
        {
            LogicWorld logic_world = GetLogicWorld();
            var        schedeler   = logic_world.GetTaskScheduler();

            schedeler.Schedule(m_task, logic_world.GetCurrentTime(), LOGIC_UPDATE_INTERVAL, LOGIC_UPDATE_INTERVAL);
            m_remain_time = m_time;
#if COMBAT_CLIENT
            Skill skill = GetOwnerSkill();
            LocomoteRenderMessage msg = RenderMessage.Create <LocomoteRenderMessage>();
            msg.ConstructAsStartMoving(skill.GetOwnerEntityID(), true, LocomoteRenderMessage.NotLocomotion);
            GetLogicWorld().AddRenderMessage(msg);
#endif
        }
Exemple #5
0
        public void DeactivateOnOneTarget(Entity target)
        {
            var enumerator = m_effect2entity.GetEnumerator();

            while (enumerator.MoveNext())
            {
                if (enumerator.Current.Value != target.ID)
                {
                    continue;
                }
                RemoveEffectTask task = LogicTask.Create <RemoveEffectTask>();
                task.Construct(target.ID, enumerator.Current.Key);
                LogicWorld logic_world = m_generator.GetLogicWorld();
                var        schedeler   = logic_world.GetTaskScheduler();
                schedeler.Schedule(task, logic_world.GetCurrentTime(), FixPoint.Zero);
            }
        }