Exemplo n.º 1
0
        internal int GetTrackSendImpact(int targetId, int seq, Dictionary <string, object> args)
        {
            int        impactId = 0;
            EntityInfo npc      = m_Scene.EntityManager.GetEntityInfo(targetId);

            if (null != npc)
            {
                ImpactInfo trackImpactInfo = npc.GetSkillStateInfo().GetImpactInfoBySeq(seq);
                if (null != trackImpactInfo)
                {
                    int targetImpactId = trackImpactInfo.ImpactToTarget;
                    if (targetImpactId <= 0)
                    {
                        targetImpactId = trackImpactInfo.ConfigData.impact;
                    }
                    if (targetImpactId <= 0)
                    {
                        object v;
                        if (args.TryGetValue("impact", out v))
                        {
                            targetImpactId = (int)v;
                        }
                    }
                    impactId = targetImpactId;
                }
            }
            return(impactId);
        }
Exemplo n.º 2
0
        internal GfxSkillSenderInfo BuildSkillInfo(int objId, TableConfig.Skill configData, int seq, Scene scene)
        {
            GfxSkillSenderInfo ret    = null;
            EntityInfo         entity = m_Scene.EntityManager.GetEntityInfo(objId);

            if (null != entity && null != configData)
            {
                int targetId = 0;
                if (configData.type == (int)SkillOrImpactType.Skill)
                {
                    targetId = entity.GetAiStateInfo().Target;
                }
                else
                {
                    ImpactInfo impactInfo = entity.GetSkillStateInfo().GetImpactInfoBySeq(seq);
                    if (null != impactInfo)
                    {
                        targetId = impactInfo.ImpactSenderId;
                    }
                }
                EntityInfo targetObj = m_Scene.EntityManager.GetEntityInfo(targetId);
                if (null != targetObj)
                {
                    ret = new GfxSkillSenderInfo(configData, seq, objId, entity, targetId, targetObj, scene);
                }
                else
                {
                    ret = new GfxSkillSenderInfo(configData, seq, objId, entity, scene);
                }
            }
            return(ret);
        }
 static public int constructor(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         GameFramework.ImpactInfo o;
         if (matchType(l, argc, 2, typeof(int)))
         {
             System.Int32 a1;
             checkType(l, 2, out a1);
             o = new GameFramework.ImpactInfo(a1);
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         else if (matchType(l, argc, 2, typeof(TableConfig.Skill)))
         {
             TableConfig.Skill a1;
             checkType(l, 2, out a1);
             o = new GameFramework.ImpactInfo(a1);
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         return(error(l, "New object failed."));
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 4
0
        internal int GetTrackSendImpact(int targetId, int seq, Dictionary <string, object> args)
        {
            int             impactId = 0;
            EntityViewModel view     = GetEntityViewById(targetId);

            if (null != view && null != view.Entity && null != view.Actor)
            {
                EntityInfo npc             = view.Entity;
                ImpactInfo trackImpactInfo = npc.GetSkillStateInfo().GetImpactInfoBySeq(seq);
                if (null != trackImpactInfo)
                {
                    int targetImpactId = trackImpactInfo.ImpactToTarget;
                    if (targetImpactId <= 0)
                    {
                        targetImpactId = trackImpactInfo.ConfigData.impact;
                    }
                    if (targetImpactId <= 0)
                    {
                        object v;
                        if (args.TryGetValue("impact", out v))
                        {
                            targetImpactId = (int)v;
                        }
                    }
                    impactId = targetImpactId;
                }
            }
            return(impactId);
        }
Exemplo n.º 5
0
        internal GfxSkillSenderInfo BuildSkillInfo(int objId, TableConfig.Skill configData, int seq)
        {
            GfxSkillSenderInfo ret  = null;
            EntityViewModel    view = GetEntityViewById(objId);

            if (null != view && null != view.Actor && null != view.Entity && null != configData)
            {
                EntityInfo entity   = view.Entity;
                int        targetId = 0;
                if (configData.type == (int)SkillOrImpactType.Skill)
                {
                    targetId = entity.GetAiStateInfo().Target;
                }
                else
                {
                    ImpactInfo impactInfo = entity.GetSkillStateInfo().GetImpactInfoBySeq(seq);
                    if (null != impactInfo)
                    {
                        targetId = impactInfo.ImpactSenderId;
                    }
                }
                UnityEngine.GameObject targetObj = GetGameObject(targetId);
                if (null != targetObj)
                {
                    ret = new GfxSkillSenderInfo(configData, seq, objId, view.Actor, targetId, targetObj);
                }
                else
                {
                    ret = new GfxSkillSenderInfo(configData, seq, objId, view.Actor);
                }
            }
            return(ret);
        }
Exemplo n.º 6
0
        internal ImpactInfo TrackImpact(TableConfig.Skill cfg, int seq, int curObjId, int srcObjId, int targetId, string emitBone, int emitImpact, Vector3 offset, Dictionary <string, object> args)
        {
            EntityInfo targetObj = m_Scene.EntityManager.GetEntityInfo(targetId);
            EntityInfo srcObj    = m_Scene.EntityManager.GetEntityInfo(srcObjId);

            if (null != targetObj && !targetObj.IsDead())
            {
                if (null != cfg)
                {
                    ImpactInfo impactInfo = null;
                    if (emitImpact <= 0 || emitImpact >= SkillInstance.c_FirstInnerEmitSkillId)
                    {
                        impactInfo = new ImpactInfo(m_Scene.SkillSystem.PredefinedSkill.EmitSkillCfg);
                    }
                    else
                    {
                        impactInfo = new ImpactInfo(emitImpact);
                    }
                    if (TryInitImpactInfo(impactInfo, cfg, seq, curObjId, srcObjId, args))
                    {
                        if (null != srcObj)
                        {
                            Vector3 pos = srcObj.GetMovementStateInfo().GetPosition3D();
                            pos.Y += srcObj.GetRadius();
                            impactInfo.SenderPosition = pos;
                        }
                        targetObj.GetSkillStateInfo().AddImpact(impactInfo);
                        m_Scene.SkillSystem.StartSkill(targetId, impactInfo.ConfigData, impactInfo.Seq, args);
                        return(impactInfo);
                    }
                }
            }
            return(null);
        }
Exemplo n.º 7
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);
                    }
                }
            }
        }
        private void OnAiRemoveImpact(EntityInfo entity, int impactId)
        {
            ImpactInfo impactInfo = entity.GetSkillStateInfo().FindImpactInfoById(impactId);

            if (null != impactInfo)
            {
                GfxSkillSystem.Instance.StopSkill(entity.GetId(), impactId, impactInfo.Seq, false);
            }
        }
        public static void RefixAttrByImpact(EntityInfo obj)
        {
            List <ImpactInfo> impacts = obj.GetSkillStateInfo().GetAllImpact();

            for (int i = 0; i < impacts.Count; ++i)
            {
                ImpactInfo impact = impacts[i];
                impact.RefixCharacterProperty(obj);
            }
        }
Exemplo n.º 10
0
        internal ImpactInfo SendImpact(TableConfig.Skill cfg, int seq, int curObjId, int srcObjId, int targetId, int impactId, Dictionary <string, object> args)
        {
            EntityInfo targetObj = m_Scene.EntityManager.GetEntityInfo(targetId);

            if (null != targetObj)
            {
                if (null != cfg)
                {
                    Quaternion hitEffectRotation = Quaternion.Identity;
                    EntityInfo srcObj            = m_Scene.EntityManager.GetEntityInfo(srcObjId);
                    var        addArgs           = new Dictionary <string, object> {
                        { "hitEffectRotation", hitEffectRotation }
                    };
                    ImpactInfo impactInfo = null;
                    if (impactId <= 0 || impactId >= SkillInstance.c_FirstInnerHitSkillId)
                    {
                        impactInfo = new ImpactInfo(m_Scene.SkillSystem.PredefinedSkill.HitSkillCfg);
                        impactId   = PredefinedSkill.c_HitSkillId;
                    }
                    else
                    {
                        impactInfo = new ImpactInfo(impactId);
                    }
                    if (null != impactInfo.ConfigData)
                    {
                        if (TryInitImpactInfo(impactInfo, cfg, seq, curObjId, srcObjId, args))
                        {
                            if (impactInfo.ConfigData.type == (int)SkillOrImpactType.Buff)
                            {
                                ImpactInfo oldImpactInfo = targetObj.GetSkillStateInfo().FindImpactInfoById(impactInfo.ImpactId);
                                if (null != oldImpactInfo)
                                {
                                    oldImpactInfo.DurationTime += impactInfo.DurationTime;
                                    return(oldImpactInfo);
                                }
                            }
                            targetObj.GetSkillStateInfo().AddImpact(impactInfo);
                            SkillInfo skillInfo = targetObj.GetSkillStateInfo().GetCurSkillInfo();
                            if (null != skillInfo && (cfg.isInterrupt || impactInfo.ConfigData.isInterrupt))
                            {
                                m_Scene.SkillSystem.StopSkill(targetId, skillInfo.SkillId, 0, true);
                            }
                            m_Scene.SkillSystem.StartSkill(targetId, impactInfo.ConfigData, impactInfo.Seq, args, addArgs);
                            return(impactInfo);
                        }
                    }
                    else
                    {
                        LogSystem.Error("impact {0} config can't found !", impactInfo.ImpactId);
                    }
                }
            }
            return(null);
        }
 static public int get_ImpactId(IntPtr l)
 {
     try {
         GameFramework.ImpactInfo self = (GameFramework.ImpactInfo)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.ImpactId);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 public void AddImpact(ImpactInfo info)
 {
     if (null == info.ConfigData) {
         LogSystem.Error("impact {0} config can't found !", info.ImpactId);
         return;
     }
     m_ImpactList.Add(info);
     info.Seq = m_NextImpactSeq++;
     if ((int)SkillOrImpactType.Buff == info.ConfigData.type) {
         m_BuffChanged = true;
     }
 }
 private void OnAiAddImpact(EntityInfo entity, int impactId)
 {
     ImpactInfo impactInfo = new ImpactInfo(impactId);
     impactInfo.StartTime = TimeUtility.GetLocalMilliseconds();
     impactInfo.ImpactSenderId = entity.GetId();
     impactInfo.SkillId = 0;
     if (null != impactInfo.ConfigData) {
         entity.GetSkillStateInfo().AddImpact(impactInfo);
         int seq = impactInfo.Seq;
         if (GfxSkillSystem.Instance.StartSkill(entity.GetId(), impactInfo.ConfigData, seq)) {
         }
     }
 }
Exemplo n.º 14
0
        public static void RefixAttrByImpact(EntityInfo obj)
        {
            List <ImpactInfo> impacts = obj.GetSkillStateInfo().GetAllImpact();

            for (int i = 0; i < impacts.Count; ++i)
            {
                ImpactInfo impact = impacts[i];
                if (impact.ConfigData.type == (int)SkillOrImpactType.Buff)
                {
                    impact.RefixCharacterProperty(obj);
                }
            }
        }
        public void RemoveImpact(int seq)
        {
            ImpactInfo oriImpact = GetImpactInfoBySeq(seq);

            if (oriImpact != null)
            {
                if ((int)SkillOrImpactType.Buff == oriImpact.ConfigData.type)
                {
                    m_BuffChanged = true;
                }
                m_ImpactList.Remove(oriImpact);
            }
        }
Exemplo n.º 16
0
        public UnityEngine.Vector3 GetImpactSenderPosition(int actorId, int impactId, int seq)
        {
            EntityViewModel view = GetEntityViewById(actorId);

            if (null != view && null != view.Entity)
            {
                ImpactInfo impactInfo = view.Entity.GetSkillStateInfo().GetImpactInfoBySeq(seq);
                if (null != impactInfo && impactId == impactInfo.ImpactId)
                {
                    return(new UnityEngine.Vector3(impactInfo.SenderPosition.X, impactInfo.SenderPosition.Y, impactInfo.SenderPosition.Z));
                }
            }
            return(UnityEngine.Vector3.zero);
        }
Exemplo n.º 17
0
        public int GetImpactSkillId(int actorId, int impactId, int seq)
        {
            EntityViewModel view = GetEntityViewById(actorId);

            if (null != view && null != view.Entity)
            {
                ImpactInfo impactInfo = view.Entity.GetSkillStateInfo().GetImpactInfoBySeq(seq);
                if (null != impactInfo && impactId == impactInfo.ImpactId)
                {
                    return(impactInfo.SkillId);
                }
            }
            return(0);
        }
Exemplo n.º 18
0
        internal int GetImpactDuration(int objId, int impactId, int seq)
        {
            EntityInfo entity = m_Scene.EntityManager.GetEntityInfo(objId);

            if (null != entity)
            {
                ImpactInfo impactInfo = entity.GetSkillStateInfo().GetImpactInfoBySeq(seq);
                if (null != impactInfo && impactId == impactInfo.ImpactId)
                {
                    return(impactInfo.DurationTime);
                }
            }
            return(0);
        }
Exemplo n.º 19
0
        internal int GetImpactSkillId(int actorId, int impactId, int seq)
        {
            EntityInfo entity = m_Scene.EntityManager.GetEntityInfo(actorId);

            if (null != entity)
            {
                ImpactInfo impactInfo = entity.GetSkillStateInfo().GetImpactInfoBySeq(seq);
                if (null != impactInfo && impactId == impactInfo.ImpactId)
                {
                    return(impactInfo.SkillId);
                }
            }
            return(0);
        }
Exemplo n.º 20
0
        internal Vector3 GetImpactSenderPosition(int objId, int impactId, int seq)
        {
            EntityInfo entity = m_Scene.EntityManager.GetEntityInfo(objId);

            if (null != entity)
            {
                ImpactInfo impactInfo = entity.GetSkillStateInfo().GetImpactInfoBySeq(seq);
                if (null != impactInfo && impactId == impactInfo.ImpactId)
                {
                    return(new Vector3(impactInfo.SenderPosition.X, impactInfo.SenderPosition.Y, impactInfo.SenderPosition.Z));
                }
            }
            return(Vector3.Zero);
        }
 static public int set_SenderProperty(IntPtr l)
 {
     try {
         GameFramework.ImpactInfo        self = (GameFramework.ImpactInfo)checkSelf(l);
         GameFramework.CharacterProperty v;
         checkType(l, 2, out v);
         self.SenderProperty = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 public void AddImpact(ImpactInfo info)
 {
     if (null == info.ConfigData)
     {
         LogSystem.Error("impact {0} config can't found !", info.ImpactId);
         return;
     }
     m_ImpactList.Add(info);
     info.Seq = m_NextImpactSeq++;
     if ((int)SkillOrImpactType.Buff == info.ConfigData.type)
     {
         m_BuffChanged = true;
     }
 }
 static public int RefixCharacterProperty(IntPtr l)
 {
     try {
         GameFramework.ImpactInfo self = (GameFramework.ImpactInfo)checkSelf(l);
         GameFramework.EntityInfo a1;
         checkType(l, 2, out a1);
         self.RefixCharacterProperty(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int set_DamageData(IntPtr l)
 {
     try {
         GameFramework.ImpactInfo    self = (GameFramework.ImpactInfo)checkSelf(l);
         TableConfig.SkillDamageData v;
         checkType(l, 2, out v);
         self.DamageData = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int set_SenderPosition(IntPtr l)
 {
     try {
         GameFramework.ImpactInfo self = (GameFramework.ImpactInfo)checkSelf(l);
         ScriptRuntime.Vector3    v;
         checkValueType(l, 2, out v);
         self.SenderPosition = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int set_ImpactId(IntPtr l)
 {
     try {
         GameFramework.ImpactInfo self = (GameFramework.ImpactInfo)checkSelf(l);
         System.Int32             v;
         checkType(l, 2, out v);
         self.ImpactId = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
        private void OnAiAddImpact(EntityInfo entity, int impactId)
        {
            ImpactInfo impactInfo = new ImpactInfo(impactId);

            impactInfo.StartTime      = TimeUtility.GetLocalMilliseconds();
            impactInfo.ImpactSenderId = entity.GetId();
            impactInfo.SkillId        = 0;
            if (null != impactInfo.ConfigData)
            {
                entity.GetSkillStateInfo().AddImpact(impactInfo);
                int seq = impactInfo.Seq;
                if (GfxSkillSystem.Instance.StartSkill(entity.GetId(), impactInfo.ConfigData, seq))
                {
                }
            }
        }
Exemplo n.º 28
0
        private bool TryInitImpactInfo(ImpactInfo impactInfo, TableConfig.Skill cfg, int seq, int curObjId, int srcObjId, Dictionary <string, object> args)
        {
            bool            ret     = false;
            EntityInfo      srcNpc  = null;
            EntityViewModel srcView = GetEntityViewById(srcObjId);

            if (null != srcView && null != srcView.Entity)
            {
                srcNpc = srcView.Entity;
            }
            impactInfo.StartTime      = TimeUtility.GetLocalMilliseconds();
            impactInfo.ImpactSenderId = srcObjId;
            if (cfg.type == (int)SkillOrImpactType.Skill)
            {
                impactInfo.SenderPosition = null != srcNpc?srcNpc.GetMovementStateInfo().GetPosition3D() : ScriptRuntime.Vector3.Zero;

                impactInfo.SkillId      = cfg.id;
                impactInfo.DurationTime = impactInfo.ConfigData.impactData.duration;
                impactInfo.TargetType   = cfg.targetType;
                impactInfo.DamageData.CopyFrom(cfg.damageData);
                impactInfo.DamageData.Merge(impactInfo.ConfigData.damageData);
                impactInfo.ImpactToTarget = cfg.impact;
                ret = true;
            }
            else
            {
                ImpactInfo      srcImpactInfo = null;
                EntityViewModel myView        = GetEntityViewById(curObjId);
                if (null != myView && null != myView.Entity)
                {
                    srcImpactInfo = myView.Entity.GetSkillStateInfo().GetImpactInfoBySeq(seq);
                }
                if (null != srcImpactInfo)
                {
                    //如果当前技能配置有数据则继承当前配置数据,否则继承源impact记录的数据。
                    impactInfo.SenderPosition = srcImpactInfo.SenderPosition;
                    impactInfo.SkillId        = srcImpactInfo.SkillId;
                    impactInfo.DurationTime   = srcImpactInfo.DurationTime > 0 ? srcImpactInfo.DurationTime : impactInfo.ConfigData.impactData.duration;
                    impactInfo.TargetType     = srcImpactInfo.TargetType;
                    impactInfo.DamageData.CopyFrom(srcImpactInfo.DamageData);
                    impactInfo.DamageData.Merge(impactInfo.ConfigData.damageData);
                    impactInfo.ImpactToTarget = cfg.impact != 0 ? cfg.impact : srcImpactInfo.ImpactToTarget;
                    ret = true;
                }
            }
            return(ret);
        }
Exemplo n.º 29
0
        public ImpactInfo TrackImpact(TableConfig.Skill cfg, int seq, int curObjId, int srcObjId, int targetId, string emitBone, int emitImpact, UnityEngine.Vector3 offset, bool isFinal, Dictionary <string, object> args)
        {
            EntityViewModel view    = GetEntityViewById(targetId);
            EntityViewModel srcView = GetEntityViewById(srcObjId);

            if (null != view && null != view.Entity && null != view.Actor && !view.Entity.IsDeadSkillCasting())
            {
                EntityInfo npc = view.Entity;
                if (null != cfg)
                {
                    ImpactInfo impactInfo = null;
                    if (emitImpact <= 0 || emitImpact >= SkillInstance.c_FirstInnerEmitSkillId)
                    {
                        impactInfo = new ImpactInfo(PredefinedSkill.Instance.EmitSkillCfg);
                    }
                    else
                    {
                        impactInfo = new ImpactInfo(emitImpact);
                    }
                    if (TryInitImpactInfo(impactInfo, cfg, seq, curObjId, srcObjId, args))
                    {
                        UnityEngine.GameObject srcObj = GetGameObject(srcObjId);
                        if (null != srcObj)
                        {
                            UnityEngine.Transform t = Utility.FindChildRecursive(srcObj.transform, emitBone);
                            if (null != t)
                            {
                                UnityEngine.Vector3 pos = t.TransformPoint(offset);
                                impactInfo.SenderPosition = new ScriptRuntime.Vector3(pos.x, pos.y, pos.z);
                            }
                            else
                            {
                                UnityEngine.Vector3 pos = srcObj.transform.TransformPoint(offset);
                                pos.y += npc.GetRadius();
                                impactInfo.SenderPosition = new ScriptRuntime.Vector3(pos.x, pos.y, pos.z);
                            }
                        }
                        impactInfo.DamageData.IsFinal = isFinal;
                        npc.GetSkillStateInfo().AddImpact(impactInfo);
                        GfxSkillSystem.Instance.StartSkill(targetId, impactInfo.ConfigData, impactInfo.Seq, args);
                        return(impactInfo);
                    }
                }
            }
            return(null);
        }
Exemplo n.º 30
0
        public ImpactInfo TrackSendImpact(int targetId, int impactId, int seq, int impactToTarget, Dictionary <string, object> args)
        {
            EntityViewModel view = GetEntityViewById(targetId);

            if (null != view && null != view.Entity && null != view.Actor && !view.Entity.IsDeadSkillCasting())
            {
                EntityInfo npc             = view.Entity;
                ImpactInfo trackImpactInfo = npc.GetSkillStateInfo().GetImpactInfoBySeq(seq);
                if (null != trackImpactInfo && impactId == trackImpactInfo.ImpactId)
                {
                    ImpactInfo impactInfo = null;
                    if (impactToTarget <= 0 || impactToTarget >= SkillInstance.c_FirstInnerHitSkillId)
                    {
                        impactToTarget = PredefinedSkill.c_HitSkillId;
                        impactInfo     = new ImpactInfo(PredefinedSkill.Instance.HitSkillCfg);
                    }
                    var addArgs = new Dictionary <string, object>();
                    if (null == impactInfo)
                    {
                        impactInfo = new ImpactInfo(impactId);
                    }
                    impactInfo.StartTime      = TimeUtility.GetLocalMilliseconds();
                    impactInfo.ImpactSenderId = trackImpactInfo.ImpactSenderId;
                    impactInfo.SenderPosition = trackImpactInfo.SenderPosition;
                    impactInfo.SkillId        = trackImpactInfo.SkillId;
                    impactInfo.DurationTime   = trackImpactInfo.DurationTime > 0 ? trackImpactInfo.DurationTime : impactInfo.ConfigData.impactData.duration;
                    impactInfo.TargetType     = trackImpactInfo.TargetType;
                    impactInfo.DamageData.CopyFrom(trackImpactInfo.DamageData);
                    impactInfo.DamageData.Merge(impactInfo.ConfigData.damageData);
                    if (impactInfo.ConfigData.type == (int)SkillOrImpactType.Buff)
                    {
                        ImpactInfo oldImpactInfo = npc.GetSkillStateInfo().FindImpactInfoById(impactInfo.ImpactId);
                        if (null != oldImpactInfo)
                        {
                            oldImpactInfo.DurationTime += impactInfo.DurationTime;
                            return(oldImpactInfo);
                        }
                    }
                    npc.GetSkillStateInfo().AddImpact(impactInfo);
                    GfxSkillSystem.Instance.StartSkill(targetId, impactInfo.ConfigData, impactInfo.Seq, args, addArgs);
                    return(impactInfo);
                }
            }
            return(null);
        }
Exemplo n.º 31
0
        private void OnAiRemoveImpact(EntityInfo npc, int impactId)
        {
            Scene scene = npc.SceneContext.CustomData as Scene;

            if (null != scene)
            {
                ImpactInfo impactInfo = npc.GetSkillStateInfo().FindImpactInfoById(impactId);
                if (null != impactInfo)
                {
                    Msg_RC_RemoveImpact removeImpactBuilder = new Msg_RC_RemoveImpact();
                    removeImpactBuilder.obj_id    = npc.GetId();
                    removeImpactBuilder.impact_id = impactId;
                    scene.NotifyAllUser(RoomMessageDefine.Msg_RC_RemoveImpact, removeImpactBuilder);

                    scene.SkillSystem.StopSkill(npc.GetId(), impactId, impactInfo.Seq, false);
                }
            }
        }
Exemplo n.º 32
0
        internal ImpactInfo TrackSendImpact(int targetId, int impactId, int seq, int impactToTarget, Dictionary <string, object> args)
        {
            EntityInfo targetObj = m_Scene.EntityManager.GetEntityInfo(targetId);

            if (null != targetObj && !targetObj.IsDead())
            {
                ImpactInfo trackImpactInfo = targetObj.GetSkillStateInfo().GetImpactInfoBySeq(seq);
                if (null != trackImpactInfo && impactId == trackImpactInfo.ImpactId)
                {
                    ImpactInfo impactInfo = null;
                    if (impactToTarget <= 0 || impactToTarget >= SkillInstance.c_FirstInnerHitSkillId)
                    {
                        impactToTarget = PredefinedSkill.c_HitSkillId;
                        impactInfo     = new ImpactInfo(m_Scene.SkillSystem.PredefinedSkill.HitSkillCfg);
                    }
                    var addArgs = new Dictionary <string, object>();
                    if (null == impactInfo)
                    {
                        impactInfo = new ImpactInfo(impactId);
                    }
                    impactInfo.StartTime      = TimeUtility.GetLocalMilliseconds();
                    impactInfo.ImpactSenderId = trackImpactInfo.ImpactSenderId;
                    impactInfo.SenderPosition = trackImpactInfo.SenderPosition;
                    impactInfo.SkillId        = trackImpactInfo.SkillId;
                    impactInfo.DurationTime   = trackImpactInfo.DurationTime > 0 ? trackImpactInfo.DurationTime : impactInfo.ConfigData.duration;
                    impactInfo.TargetType     = trackImpactInfo.TargetType;
                    impactInfo.DamageData.CopyFrom(trackImpactInfo.DamageData);
                    impactInfo.DamageData.Merge(impactInfo.ConfigData.damageData);
                    if (impactInfo.ConfigData.type == (int)SkillOrImpactType.Buff)
                    {
                        ImpactInfo oldImpactInfo = targetObj.GetSkillStateInfo().FindImpactInfoById(impactInfo.ImpactId);
                        if (null != oldImpactInfo)
                        {
                            oldImpactInfo.DurationTime += impactInfo.DurationTime;
                            return(oldImpactInfo);
                        }
                    }
                    targetObj.GetSkillStateInfo().AddImpact(impactInfo);
                    m_Scene.SkillSystem.StartSkill(targetId, impactInfo.ConfigData, impactInfo.Seq, args, addArgs);
                    return(impactInfo);
                }
            }
            return(null);
        }
 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);
             }
         }
     }
 }
 internal ImpactInfo SendImpact(TableConfig.Skill cfg, int seq, int curObjId, int srcObjId, int targetId, int impactId, Dictionary<string, object> args)
 {
     EntityInfo targetObj = m_Scene.EntityManager.GetEntityInfo(targetId);
     if (null != targetObj) {
         if (null != cfg) {
             Quaternion hitEffectRotation = Quaternion.Identity;
             EntityInfo srcObj = m_Scene.EntityManager.GetEntityInfo(srcObjId);
             var addArgs = new Dictionary<string, object> { { "hitEffectRotation", hitEffectRotation } };
             ImpactInfo impactInfo = null;
             if (impactId <= 0 || impactId >= SkillInstance.c_FirstInnerHitSkillId) {
                 impactInfo = new ImpactInfo(m_Scene.SkillSystem.PredefinedSkill.HitSkillCfg);
                 impactId = PredefinedSkill.c_HitSkillId;
             } else {
                 impactInfo = new ImpactInfo(impactId);
             }
             if (null != impactInfo.ConfigData) {
                 if (TryInitImpactInfo(impactInfo, cfg, seq, curObjId, srcObjId, args)) {
                     if (impactInfo.ConfigData.type == (int)SkillOrImpactType.Buff) {
                         ImpactInfo oldImpactInfo = targetObj.GetSkillStateInfo().FindImpactInfoById(impactInfo.ImpactId);
                         if (null != oldImpactInfo) {
                             oldImpactInfo.DurationTime += impactInfo.DurationTime;
                             return oldImpactInfo;
                         }
                     }
                 targetObj.GetSkillStateInfo().AddImpact(impactInfo);
                 SkillInfo skillInfo = targetObj.GetSkillStateInfo().GetCurSkillInfo();
                 if (null != skillInfo && (cfg.isInterrupt || impactInfo.ConfigData.isInterrupt)) {
                     m_Scene.SkillSystem.StopSkill(targetId, skillInfo.SkillId, 0, true);
                 }
                 m_Scene.SkillSystem.StartSkill(targetId, impactInfo.ConfigData, impactInfo.Seq, args, addArgs);
                 return impactInfo;
                 }
             } else {
                 LogSystem.Error("impact {0} config can't found !", impactInfo.ImpactId);
             }
         }
     }
     return null;
 }
 protected override bool ExecCommand(StoryInstance instance, long delta)
 {
     int objId = m_ObjId.Value;
     int impactId = m_ImpactId.Value;
     int seq = 0;
     Dictionary<string, object> locals = new Dictionary<string, object>();
     for (int i = 0; i < m_Args.Count - 1; i += 2) {
         string key = m_Args[i].Value as string;
         object val = m_Args[i + 1].Value;
         if (!string.IsNullOrEmpty(key)) {
             locals.Add(key, val);
         }
     }
     EntityInfo obj = ClientModule.Instance.GetEntityById(objId);
     if (null != obj) {
         ImpactInfo impactInfo = new ImpactInfo(impactId);
         impactInfo.StartTime = TimeUtility.GetLocalMilliseconds();
         impactInfo.ImpactSenderId = objId;
         impactInfo.SkillId = 0;
         if (null != impactInfo.ConfigData) {
             obj.GetSkillStateInfo().AddImpact(impactInfo);
             seq = impactInfo.Seq;
             GfxSkillSystem.Instance.StartSkill(objId, impactInfo.ConfigData, seq, locals);
         }
     }
     if (m_HaveSeq) {
         string varName = m_SeqVarName.Value;
         instance.SetVariable(varName, seq);
     }
     return false;
 }
 internal ImpactInfo TrackImpact(TableConfig.Skill cfg, int seq, int curObjId, int srcObjId, int targetId, string emitBone, int emitImpact, Vector3 offset, Dictionary<string, object> args)
 {
     EntityInfo targetObj = m_Scene.EntityManager.GetEntityInfo(targetId);
     EntityInfo srcObj = m_Scene.EntityManager.GetEntityInfo(srcObjId);
     if (null != targetObj && !targetObj.IsDead()) {
         if (null != cfg) {
             ImpactInfo impactInfo = null;
             if (emitImpact <= 0 || emitImpact >= SkillInstance.c_FirstInnerEmitSkillId) {
                 impactInfo = new ImpactInfo(m_Scene.SkillSystem.PredefinedSkill.EmitSkillCfg);
             } else {
                 impactInfo = new ImpactInfo(emitImpact);
             }
             if (TryInitImpactInfo(impactInfo, cfg, seq, curObjId, srcObjId, args)) {
                 if (null != srcObj) {
                     Vector3 pos = srcObj.GetMovementStateInfo().GetPosition3D();
                     pos.Y += srcObj.GetRadius();
                     impactInfo.SenderPosition = pos;
                 }
                 targetObj.GetSkillStateInfo().AddImpact(impactInfo);
                 m_Scene.SkillSystem.StartSkill(targetId, impactInfo.ConfigData, impactInfo.Seq, args);
                 return impactInfo;
             }
         }
     }
     return null;
 }
 private bool TryInitImpactInfo(ImpactInfo impactInfo, TableConfig.Skill cfg, int seq, int curObjId, int srcObjId, Dictionary<string, object> args)
 {
     bool ret = false;
     EntityInfo srcNpc = null;
     EntityViewModel srcView = GetEntityViewById(srcObjId);
     if (null != srcView && null != srcView.Entity) {
         srcNpc = srcView.Entity;
     }
     impactInfo.StartTime = TimeUtility.GetLocalMilliseconds();
     impactInfo.ImpactSenderId = srcObjId;
     if (cfg.type == (int)SkillOrImpactType.Skill) {
         impactInfo.SenderPosition = null != srcNpc ? srcNpc.GetMovementStateInfo().GetPosition3D() : ScriptRuntime.Vector3.Zero;
         impactInfo.SkillId = cfg.id;
         impactInfo.DurationTime = cfg.duration > 0 ? cfg.duration : impactInfo.ConfigData.duration;
         impactInfo.TargetType = cfg.targetType;
         impactInfo.DamageData.CopyFrom(cfg.damageData);
         impactInfo.DamageData.Merge(impactInfo.ConfigData.damageData);
         impactInfo.ImpactToTarget = cfg.impact;
         ret = true;
     } else {
         ImpactInfo srcImpactInfo = null;
         EntityViewModel myView = GetEntityViewById(curObjId);
         if (null != myView && null != myView.Entity) {
             srcImpactInfo = myView.Entity.GetSkillStateInfo().GetImpactInfoBySeq(seq);
         }
         if (null != srcImpactInfo) {
             //如果当前技能配置有数据则继承当前配置数据,否则继承源impact记录的数据。
             impactInfo.SenderPosition = srcImpactInfo.SenderPosition;
             impactInfo.SkillId = srcImpactInfo.SkillId;
             impactInfo.DurationTime = srcImpactInfo.DurationTime > 0 ? srcImpactInfo.DurationTime : impactInfo.ConfigData.duration;
             impactInfo.TargetType = srcImpactInfo.TargetType;
             impactInfo.DamageData.CopyFrom(srcImpactInfo.DamageData);
             impactInfo.DamageData.Merge(impactInfo.ConfigData.damageData);
             impactInfo.ImpactToTarget = cfg.impact != 0 ? cfg.impact : srcImpactInfo.ImpactToTarget;
             ret = true;
         }
     }
     return ret;
 }
 internal ImpactInfo TrackSendImpact(int targetId, int impactId, int seq, int impactToTarget, Dictionary<string, object> args)
 {
     EntityViewModel view = GetEntityViewById(targetId);
     if (null != view && null != view.Entity && null != view.Actor && !view.Entity.IsDeadSkillCasting()) {
         EntityInfo npc = view.Entity;
         ImpactInfo trackImpactInfo = npc.GetSkillStateInfo().GetImpactInfoBySeq(seq);
         if (null != trackImpactInfo && impactId == trackImpactInfo.ImpactId) {
             ImpactInfo impactInfo = null;
             if (impactToTarget <= 0 || impactToTarget >= SkillInstance.c_FirstInnerHitSkillId) {
                 impactToTarget = PredefinedSkill.c_HitSkillId;
                 impactInfo = new ImpactInfo(PredefinedSkill.Instance.HitSkillCfg);
             }
             var addArgs = new Dictionary<string, object>();
             if (null == impactInfo) {
                 impactInfo = new ImpactInfo(impactId);
             }
             impactInfo.StartTime = TimeUtility.GetLocalMilliseconds();
             impactInfo.ImpactSenderId = trackImpactInfo.ImpactSenderId;
             impactInfo.SenderPosition = trackImpactInfo.SenderPosition;
             impactInfo.SkillId = trackImpactInfo.SkillId;
             impactInfo.DurationTime = trackImpactInfo.DurationTime > 0 ? trackImpactInfo.DurationTime : impactInfo.ConfigData.duration;
             impactInfo.TargetType = trackImpactInfo.TargetType;
             impactInfo.DamageData.CopyFrom(trackImpactInfo.DamageData);
             impactInfo.DamageData.Merge(impactInfo.ConfigData.damageData);
             if (impactInfo.ConfigData.type == (int)SkillOrImpactType.Buff) {
                 ImpactInfo oldImpactInfo = npc.GetSkillStateInfo().FindImpactInfoById(impactInfo.ImpactId);
                 if (null != oldImpactInfo) {
                     oldImpactInfo.DurationTime += impactInfo.DurationTime;
                     return oldImpactInfo;
                 }
             }
             npc.GetSkillStateInfo().AddImpact(impactInfo);
             GfxSkillSystem.Instance.StartSkill(targetId, impactInfo.ConfigData, impactInfo.Seq, args, addArgs);
             return impactInfo;
         }
     }
     return null;
 }
 internal ImpactInfo TrackImpact(TableConfig.Skill cfg, int seq, int curObjId, int srcObjId, int targetId, string emitBone, int emitImpact, UnityEngine.Vector3 offset, bool isFinal, Dictionary<string, object> args)
 {
     EntityViewModel view = GetEntityViewById(targetId);
     EntityViewModel srcView = GetEntityViewById(srcObjId);
     if (null != view && null != view.Entity && null != view.Actor && !view.Entity.IsDeadSkillCasting()) {
         EntityInfo npc = view.Entity;
         if (null != cfg) {
             ImpactInfo impactInfo = null;
             if (emitImpact <= 0 || emitImpact >= SkillInstance.c_FirstInnerEmitSkillId) {
                 impactInfo = new ImpactInfo(PredefinedSkill.Instance.EmitSkillCfg);
             } else {
                 impactInfo = new ImpactInfo(emitImpact);
             }
             if (TryInitImpactInfo(impactInfo, cfg, seq, curObjId, srcObjId, args)) {
                 UnityEngine.GameObject srcObj = GetGameObject(srcObjId);
                 if (null != srcObj) {
                     UnityEngine.Transform t = Utility.FindChildRecursive(srcObj.transform, emitBone);
                     if (null != t) {
                         UnityEngine.Vector3 pos = t.TransformPoint(offset);
                         impactInfo.SenderPosition = new ScriptRuntime.Vector3(pos.x, pos.y, pos.z);
                     } else {
                         UnityEngine.Vector3 pos = srcObj.transform.TransformPoint(offset);
                         pos.y += npc.GetRadius();
                         impactInfo.SenderPosition = new ScriptRuntime.Vector3(pos.x, pos.y, pos.z);
                     }
                 }
                 impactInfo.DamageData.IsFinal = isFinal;
                 npc.GetSkillStateInfo().AddImpact(impactInfo);
                 GfxSkillSystem.Instance.StartSkill(targetId, impactInfo.ConfigData, impactInfo.Seq, args);
                 return impactInfo;
             }
         }
     }
     return null;
 }
 internal ImpactInfo SendImpact(TableConfig.Skill cfg, int seq, int curObjId, int srcObjId, int targetId, int impactId, bool isFinal, Dictionary<string, object> args)
 {
     EntityViewModel view = GetEntityViewById(targetId);
     if (null != view && null != view.Entity && null != view.Actor && !view.Entity.IsDeadSkillCasting()) {
         EntityInfo npc = view.Entity;
         if (null != cfg) {
             UnityEngine.Quaternion hitEffectRotation = UnityEngine.Quaternion.identity;
             UnityEngine.GameObject srcObj = GetGameObject(srcObjId);
             UnityEngine.GameObject targetObj = view.Actor;
             if (null != srcObj && null != targetObj) {
                 hitEffectRotation = srcObj.transform.localRotation;
             }
             var addArgs = new Dictionary<string, object> { { "hitEffectRotation", hitEffectRotation } };
             ImpactInfo impactInfo = null;
             if (impactId <= 0 || impactId >= SkillInstance.c_FirstInnerHitSkillId) {
                 impactInfo = new ImpactInfo(PredefinedSkill.Instance.HitSkillCfg);
                 impactId = PredefinedSkill.c_HitSkillId;
             } else {
                 impactInfo = new ImpactInfo(impactId);
             }
             if (null != impactInfo.ConfigData) {
                 if (TryInitImpactInfo(impactInfo, cfg, seq, curObjId, srcObjId, args)) {
                     if (impactInfo.ConfigData.type == (int)SkillOrImpactType.Buff) {
                         ImpactInfo oldImpactInfo = npc.GetSkillStateInfo().FindImpactInfoById(impactInfo.ImpactId);
                         if (null != oldImpactInfo) {
                             oldImpactInfo.DurationTime += impactInfo.DurationTime;
                             return oldImpactInfo;
                         }
                     }
                     impactInfo.DamageData.IsFinal = isFinal;
                     npc.GetSkillStateInfo().AddImpact(impactInfo);
                     SkillInfo skillInfo = npc.GetSkillStateInfo().GetCurSkillInfo();
                     if (null != skillInfo && (cfg.isInterrupt || impactInfo.ConfigData.isInterrupt)) {
                         GfxSkillSystem.Instance.StopSkill(targetId, skillInfo.SkillId, 0, true);
                     }
                     GfxSkillSystem.Instance.StartSkill(targetId, impactInfo.ConfigData, impactInfo.Seq, args, addArgs);
                     return impactInfo;
                 }
             } else {
                 LogSystem.Error("impact {0} config can't found !", impactInfo.ImpactId);
             }
         }
     }
     return null;
 }
Exemplo n.º 41
0
 protected override bool ExecCommand(StoryInstance instance, long delta)
 {
     Scene scene = instance.Context as Scene;
     if (null != scene) {
         int unitId = m_UnitId.Value;
         int impactId = m_ImpactId.Value;
         int seq = 0;
         Dictionary<string, object> locals = new Dictionary<string, object>();
         for (int i = 0; i < m_Args.Count - 1; i += 2) {
             string key = m_Args[i].Value as string;
             object val = m_Args[i + 1].Value;
             if (!string.IsNullOrEmpty(key)) {
                 locals.Add(key, val);
             }
         }
         EntityInfo obj = scene.SceneContext.GetEntityByUnitId(unitId);
         if (null != obj) {
             ImpactInfo impactInfo = new ImpactInfo(impactId);
             impactInfo.StartTime = TimeUtility.GetLocalMilliseconds();
             impactInfo.ImpactSenderId = obj.GetId();
             impactInfo.SkillId = 0;
             if (null != impactInfo.ConfigData) {
                 obj.GetSkillStateInfo().AddImpact(impactInfo);
                 seq = impactInfo.Seq;
                 if (scene.SkillSystem.StartSkill(obj.GetId(), impactInfo.ConfigData, seq, locals)) {
                     Msg_RC_AddImpact addImpactBuilder = new Msg_RC_AddImpact();
                     addImpactBuilder.sender_id = obj.GetId();
                     addImpactBuilder.target_id = obj.GetId();
                     addImpactBuilder.impact_id = impactId;
                     addImpactBuilder.skill_id = -1;
                     addImpactBuilder.duration = impactInfo.DurationTime;
                     scene.NotifyAllUser(RoomMessageDefine.Msg_RC_AddImpact, addImpactBuilder);
                 }
             }
         }
         if (m_HaveSeq) {
             string varName = m_SeqVarName.Value;
             instance.SetVariable(varName, seq);
         }
     }
     return false;
 }