예제 #1
0
        private void OnAiAddImpact(EntityInfo npc, int impactId)
        {
            Scene scene = npc.SceneContext.CustomData as Scene;

            if (null != scene)
            {
                ImpactInfo impactInfo = new ImpactInfo(impactId);
                impactInfo.StartTime      = TimeUtility.GetLocalMilliseconds();
                impactInfo.ImpactSenderId = npc.GetId();
                impactInfo.SkillId        = 0;
                if (null != impactInfo.ConfigData)
                {
                    npc.GetSkillStateInfo().AddImpact(impactInfo);
                    int seq = impactInfo.Seq;
                    if (scene.SkillSystem.StartSkill(npc.GetId(), impactInfo.ConfigData, seq))
                    {
                        Msg_RC_AddImpact addImpactBuilder = new Msg_RC_AddImpact();
                        addImpactBuilder.sender_id = npc.GetId();
                        addImpactBuilder.target_id = npc.GetId();
                        addImpactBuilder.impact_id = impactId;
                        addImpactBuilder.skill_id  = -1;
                        addImpactBuilder.duration  = impactInfo.DurationTime;
                        scene.NotifyAllUser(RoomMessageDefine.Msg_RC_AddImpact, addImpactBuilder);
                    }
                }
            }
        }
예제 #2
0
    internal static void Execute(object msg, NetConnection conn)
    {
        Msg_RC_AddImpact message = msg as Msg_RC_AddImpact;

        if (null == message)
        {
            return;
        }
        int        skillId  = message.skill_id;
        int        impactId = message.impact_id;
        EntityInfo target   = PluginFramework.Instance.SceneContext.GetEntityById(message.target_id);

        if (null == target)
        {
            LogSystem.Info("Receive Msg_RC_AddImpact, message.target_id={0} is not available", message.target_id);
            return;
        }
        else
        {
            LogSystem.Info("Receive Msg_RC_AddImpact, TargetId={0}, ImpactId={1}, SenderId={2}, SkillId={3}",
                           message.target_id, impactId, message.sender_id, skillId);
        }
        Vector3    senderPos = Vector3.Zero;
        EntityInfo sender    = PluginFramework.Instance.GetEntityById(message.sender_id);

        senderPos = sender.GetMovementStateInfo().GetPosition3D();

        ImpactInfo impactInfo = new ImpactInfo(impactId);

        impactInfo.StartTime      = TimeUtility.GetLocalMilliseconds();
        impactInfo.SkillId        = skillId;
        impactInfo.DurationTime   = message.duration;
        impactInfo.SenderPosition = senderPos;
        impactInfo.ImpactSenderId = message.sender_id;
        if (null != impactInfo.ConfigData)
        {
            target.GetSkillStateInfo().AddImpact(impactInfo);
            int seq = impactInfo.Seq;
            if (GfxSkillSystem.Instance.StartSkill(target.GetId(), impactInfo.ConfigData, seq))
            {
            }
        }
    }