コード例 #1
0
        public void Explode(Entity entity)
        {
#if COMBAT_CLIENT
            if (m_collision_sound_cfgid > 0)
            {
                PlaySoundMessage sound_msg = RenderMessage.Create <PlaySoundMessage>();
                sound_msg.Construct(GetOwnerEntityID(), m_collision_sound_cfgid, FixPoint.MinusOne);
                GetLogicWorld().AddRenderMessage(sound_msg);
            }
#endif

            ApplyGenerator(entity);

            if (entity == null || !m_pierce_entity)
            {
#if COMBAT_CLIENT
                LocomoteRenderMessage msg = RenderMessage.Create <LocomoteRenderMessage>();
                msg.ConstructAsStopMoving(ParentObject.ID, true);
                GetLogicWorld().AddRenderMessage(msg);
#endif
                if (m_task != null)
                {
                    m_task.Cancel();
                    LogicTask.Recycle(m_task);
                    m_task = null;
                }
                EntityUtil.KillEntity((Entity)ParentObject, ParentObject.ID);
            }
        }
コード例 #2
0
        protected override void OnActionUpdate(FixPoint delta_time)
        {
#if COMBAT_CLIENT
            Skill            skill = GetOwnerSkill();
            PlaySoundMessage msg   = RenderMessage.Create <PlaySoundMessage>();
            msg.Construct(skill.GetOwnerEntityID(), m_sound, FixPoint.MinusOne);
            GetLogicWorld().AddRenderMessage(msg);
#endif
        }
コード例 #3
0
        bool PostActivate(FixPoint start_time)
        {
            if (m_definition_component.NeedGatherTargets)
            {
                BuildSkillTargets();
                if (!CheckTargetRange())
                {
                    Deactivate(false);
                    return(false);
                }
            }

            FixPoint mana_cost = m_definition_component.ManaCost;

            if (mana_cost > FixPoint.Zero)
            {
                if (!m_mana_component.ChangeMana(m_definition_component.ManaType, -mana_cost))
                {
                    Deactivate(false);
                    return(false);
                }
            }

            var enumerator = m_components.GetEnumerator();

            while (enumerator.MoveNext())
            {
                SkillComponent cmp = enumerator.Current.Value as SkillComponent;
                if (cmp != null)
                {
                    cmp.PostActivate(start_time);
                }
            }

            m_definition_component.StartCooldownTimer(start_time, m_owner_component);

            if (m_definition_component.InflictTime > FixPoint.Zero)
            {
                m_definition_component.StartInflictingTimer(start_time, m_owner_component);
            }
            else
            {
                Inflict(start_time);
            }

            if (m_definition_component.NormalAttack)
            {
                GetOwnerEntity().SendSignal(SignalType.CastNormalAttack);
            }
            else if (!m_definition_component.StartsActive)
            {
                GetOwnerEntity().SendSignal(SignalType.CastSkill);
            }

            string main_animation = m_definition_component.GenerateMainActionNameLogicly();

#if COMBAT_CLIENT
            if (main_animation != null)
            {
                PlayAnimationRenderMessage msg = RenderMessage.Create <PlayAnimationRenderMessage>();
                FixPoint speed = m_definition_component.NormalAttack ? m_owner_component.AttackSpeedRate : FixPoint.One;
                if (m_definition_component.m_expiration_animation == null)
                {
                    msg.Construct(GetOwnerEntityID(), main_animation, AnimationName.IDLE, true, speed);
                }
                else
                {
                    msg.Construct(GetOwnerEntityID(), main_animation, m_definition_component.m_expiration_animation, true, speed);
                }
                GetLogicWorld().AddRenderMessage(msg);
            }
            int render_effect_cfgid = m_definition_component.GetMainRenderEffectConfigID();
            if (render_effect_cfgid > 0)
            {
                PlayRenderEffectMessage msg = RenderMessage.Create <PlayRenderEffectMessage>();
                msg.ConstructAsPlay(GetOwnerEntityID(), render_effect_cfgid, FixPoint.MinusOne);
                GetLogicWorld().AddRenderMessage(msg);
            }
            if (m_definition_component.m_main_sound > 0)
            {
                PlaySoundMessage msg = RenderMessage.Create <PlaySoundMessage>();
                msg.Construct(GetOwnerEntityID(), m_definition_component.m_main_sound, FixPoint.MinusOne);
                GetLogicWorld().AddRenderMessage(msg);
            }
#endif
            return(true);
        }