internal void Trigger(GfxSkillSenderInfo sender, float time, float height, float qteStartTime, float qteDuration, float qteHeight, float qteButtonDuration, string upAnim, string downAnim, string falldownAnim, float animFadeTime)
        {
            int        id, senderId;
            GameObject target;

            if (sender.ConfigData.type == (int)SkillOrImpactType.Skill)
            {
                senderId = sender.ObjId;
                id       = sender.TargetObjId;
                target   = sender.TargetGfxObj;
            }
            else
            {
                senderId = sender.TargetObjId;
                id       = sender.ObjId;
                target   = sender.GfxObj;
            }
            if (null != target)
            {
                EntityInfo senderObj = PluginFramework.Instance.GetEntityById(senderId);
                EntityInfo targetObj = PluginFramework.Instance.GetEntityById(id);
                HitFlight  hitFlight;
                if (!m_HitFlights.TryGetValue(id, out hitFlight))
                {
                    hitFlight = new HitFlight();
                    m_HitFlights.Add(id, hitFlight);
                    EntityController.Instance.AddState(id, "float");
                }
                hitFlight.Trigger(sender, target, time, height, qteStartTime, qteDuration, qteHeight, qteButtonDuration, upAnim, downAnim, falldownAnim, animFadeTime);
            }
        }
Esempio n. 2
0
 static public int get_ActorId(IntPtr l)
 {
     try {
         GameFramework.Skill.GfxSkillSenderInfo self = (GameFramework.Skill.GfxSkillSenderInfo)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.ActorId);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Esempio n. 3
0
 static public int set_TargetActorId(IntPtr l)
 {
     try {
         GameFramework.Skill.GfxSkillSenderInfo self = (GameFramework.Skill.GfxSkillSenderInfo)checkSelf(l);
         int v;
         checkType(l, 2, out v);
         self.TargetActorId = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Esempio n. 4
0
 static public int set_TrackEffectObj(IntPtr l)
 {
     try {
         GameFramework.Skill.GfxSkillSenderInfo self = (GameFramework.Skill.GfxSkillSenderInfo)checkSelf(l);
         UnityEngine.GameObject v;
         checkType(l, 2, out v);
         self.TrackEffectObj = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
        public SkillInstance GetActiveSkillInfo(int index, out GfxSkillSenderInfo sender)
        {
            int ct = m_SkillLogicInfos.Count;

            if (index >= 0 && index < ct)
            {
                var info = m_SkillLogicInfos[index];
                sender = info.Sender;
                return(info.SkillInst);
            }
            else
            {
                sender = null;
                return(null);
            }
        }
Esempio n. 6
0
 static public int constructor(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         GameFramework.Skill.GfxSkillSenderInfo o;
         if (argc == 5)
         {
             TableConfig.Skill a1;
             checkType(l, 2, out a1);
             System.Int32 a2;
             checkType(l, 3, out a2);
             System.Int32 a3;
             checkType(l, 4, out a3);
             UnityEngine.GameObject a4;
             checkType(l, 5, out a4);
             o = new GameFramework.Skill.GfxSkillSenderInfo(a1, a2, a3, a4);
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         else if (argc == 7)
         {
             TableConfig.Skill a1;
             checkType(l, 2, out a1);
             System.Int32 a2;
             checkType(l, 3, out a2);
             System.Int32 a3;
             checkType(l, 4, out a3);
             UnityEngine.GameObject a4;
             checkType(l, 5, out a4);
             System.Int32 a5;
             checkType(l, 6, out a5);
             UnityEngine.GameObject a6;
             checkType(l, 7, out a6);
             o = new GameFramework.Skill.GfxSkillSenderInfo(a1, a2, a3, a4, a5, a6);
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         return(error(l, "New object failed."));
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
        public SkillInstance FindSkillInstanceForSkillViewer(int skillId, out GfxSkillSenderInfo sender)
        {
            SkillInstance  ret       = null;
            SkillLogicInfo logicInfo = m_SkillLogicInfos.Find(info => info.SkillId == skillId);

            if (null != logicInfo)
            {
                sender = logicInfo.Sender;
                ret    = logicInfo.SkillInst;
            }
            else
            {
                sender = null;
                var instInfo = GetUnusedSkillInstanceInfoFromPool(skillId);
                if (null != instInfo)
                {
                    ret = instInfo.m_SkillInstance;
                }
            }
            return(ret);
        }
        internal void Trigger(GfxSkillSenderInfo sender, GameObject target, float time, float height, float qteStartTime, float qteDuration, float qteHeight, float qteButtonDuration, string upAnim, string downAnim, string falldownAnim, float animFadeTime)
        {
            float rate = 0.0f;

            if (m_CurTime > 0 && m_CurveTime > 0)
            {
                float curHeight = target.transform.position.y - m_BaseHeight;
                float curTime   = m_CurveTime / 2 - (float)Math.Sqrt((m_CurveHeight - curHeight) * 2.0f / m_G);
                rate = curTime / m_CurveTime;
            }
            else
            {
                m_BaseHeight = target.transform.position.y;
            }

            m_Sender            = sender;
            m_Target            = target;
            m_CurveTime         = time;
            m_CurveHeight       = height;
            m_QteStartTime      = qteStartTime;
            m_QteDuration       = qteDuration;
            m_QteHeight         = qteHeight;
            m_QteButtonDuration = qteButtonDuration;
            m_UpAnim            = upAnim;
            m_DownAnim          = downAnim;
            m_FalldownAnim      = falldownAnim;
            m_AnimFadeTime      = animFadeTime;

            m_Animator = target.GetComponentInChildren <Animator>();
            CalcYVelocityAndG();
            CalcHeightBeforeQteAndG();

            m_State      = State.Up;
            m_CurTime    = m_CurveTime * rate;
            m_CurQteTime = 0;
            m_CurHitTime = 0;

            m_Animator.speed = 1.0f;
            m_Animator.Play(m_UpAnim, -1, 0);
        }
        internal void Hit(GfxSkillSenderInfo sender, float duration)
        {
            int        id;
            GameObject target;

            if (sender.ConfigData.type == (int)SkillOrImpactType.Skill)
            {
                id     = sender.TargetObjId;
                target = sender.TargetGfxObj;
            }
            else
            {
                id     = sender.ObjId;
                target = sender.GfxObj;
            }
            if (null != target)
            {
                HitFlight hitFlight;
                if (m_HitFlights.TryGetValue(id, out hitFlight))
                {
                    hitFlight.Hit(duration);
                }
            }
        }
        public bool StartSkill(int actorId, TableConfig.Skill configData, int seq, params Dictionary <string, object>[] locals)
        {
            bool ret = false;

            if (null == configData)
            {
                LogSystem.Error("{0} can't cast skill, config is null !", actorId, seq);
                Helper.LogCallStack();
                return(false);
            }
            if (!EntityController.Instance.CanCastSkill(actorId, configData, seq))
            {
                EntityController.Instance.CancelCastSkill(actorId);
                LogSystem.Warn("{0} can't cast skill {1} {2}, cancel.", actorId, configData.id, seq);
                EntityController.Instance.CancelIfImpact(actorId, configData, seq);
                return(false);
            }
            GfxSkillSenderInfo senderInfo = EntityController.Instance.BuildSkillInfo(actorId, configData, seq);

            if (null != senderInfo && null != senderInfo.GfxObj)
            {
                int            skillId   = senderInfo.SkillId;
                GameObject     obj       = senderInfo.GfxObj;
                SkillLogicInfo logicInfo = m_SkillLogicInfos.Find(info => info.GfxObj == obj && info.SkillId == skillId && info.Seq == seq);
                if (logicInfo != null)
                {
                    LogSystem.Warn("{0} is casting skill {1} {2}, cancel.", actorId, skillId, seq);
                    EntityController.Instance.CancelIfImpact(actorId, configData, seq);
                    return(false);
                }
                SkillInstanceInfo inst          = null;
                SkillInstance     innerInstance = null;
                if (skillId == PredefinedSkill.c_EmitSkillId)
                {
                    for (int i = 0; i < locals.Length; ++i)
                    {
                        object instObj;
                        if (locals[i].TryGetValue("emitskill", out instObj))
                        {
                            innerInstance = instObj as SkillInstance;
                        }
                    }
                    if (null == innerInstance)
                    {
                        LogSystem.Warn("{0} use predefined skill {1} {2} but not found emitskill, cancel.", actorId, skillId, seq);
                        //EntityController.Instance.CancelIfImpact(actorId, configData, seq);
                        //return false;
                    }
                }
                else if (skillId == PredefinedSkill.c_HitSkillId)
                {
                    for (int i = 0; i < locals.Length; ++i)
                    {
                        object instObj;
                        if (locals[i].TryGetValue("hitskill", out instObj))
                        {
                            innerInstance = instObj as SkillInstance;
                        }
                    }
                    if (null == innerInstance)
                    {
                        LogSystem.Warn("{0} use predefined skill {1} {2} but not found hitskill, cancel.", actorId, skillId, seq);
                        //EntityController.Instance.CancelIfImpact(actorId, configData, seq);
                        //return false;
                    }
                }
                if (null == innerInstance)
                {
                    inst = NewSkillInstance(skillId, senderInfo.ConfigData);
                }
                else
                {
                    inst = NewInnerSkillInstance(skillId, innerInstance);
                }
                if (null != inst)
                {
                    m_SkillLogicInfos.Add(new SkillLogicInfo(senderInfo, inst));
                }
                else
                {
                    LogSystem.Warn("{0} cast skill {1} {2}, alloc failed.", actorId, skillId, seq);
                    EntityController.Instance.CancelIfImpact(actorId, configData, seq);
                    return(false);
                }

                logicInfo = m_SkillLogicInfos.Find(info => info.GfxObj == obj && info.SkillId == skillId && info.Seq == seq);
                if (null != logicInfo)
                {
                    if (null != locals)
                    {
                        int localCount = locals.Length;
                        for (int i = 0; i < localCount; ++i)
                        {
                            foreach (KeyValuePair <string, object> pair in locals[i])
                            {
                                logicInfo.SkillInst.SetVariable(pair.Key, pair.Value);
                            }
                        }
                    }
                    GameObject target = senderInfo.TargetGfxObj;
                    if (null != target && target != obj && configData.type == (int)SkillOrImpactType.Skill)
                    {
                        Trigers.TriggerUtil.Lookat(obj, target.transform.position);
                    }
                    EntityController.Instance.ActivateSkill(actorId, skillId, seq);
                    logicInfo.SkillInst.Start(logicInfo.Sender);
                    ret = true;
                }
            }
            return(ret);
        }
        public SkillInstance FindActiveSkillInstance(int actorId, int skillId, int seq, out GfxSkillSenderInfo sender)
        {
            SkillLogicInfo logicInfo = m_SkillLogicInfos.Find(info => info.ActorId == actorId && info.SkillId == skillId && info.Seq == seq);

            if (null != logicInfo)
            {
                sender = logicInfo.Sender;
                return(logicInfo.SkillInst);
            }
            sender = null;
            return(null);
        }
 public SkillInstance FindActiveSkillInstance(int actorId, int skillId, int seq, out GfxSkillSenderInfo sender)
 {
     SkillLogicInfo logicInfo = m_SkillLogicInfos.Find(info => info.ActorId == actorId && info.SkillId == skillId && info.Seq == seq);
     if (null != logicInfo) {
         sender = logicInfo.Sender;
         return logicInfo.SkillInst;
     }
     sender = null;
     return null;
 }
        public SkillInstance FindInnerSkillInstanceForSkillViewer(int skillId, SkillInstance innerInstance, out GfxSkillSenderInfo sender)
        {
            SkillInstance  ret       = null;
            SkillLogicInfo logicInfo = m_SkillLogicInfos.Find(info => info.SkillId == skillId && info.SkillInst.InnerDslSkillId == innerInstance.InnerDslSkillId && info.SkillInst.OuterDslSkillId == innerInstance.OuterDslSkillId);

            if (null != logicInfo)
            {
                sender = logicInfo.Sender;
                ret    = logicInfo.SkillInst;
            }
            else
            {
                int newSkillId = CalcUniqueInnerSkillId(skillId, innerInstance);
                sender = null;
                var instInfo = GetUnusedSkillInstanceInfoFromPool(newSkillId);
                if (null != instInfo)
                {
                    ret = instInfo.m_SkillInstance;
                }
            }
            return(ret);
        }
 public SkillLogicInfo(GfxSkillSenderInfo sender, SkillInstanceInfo info)
 {
     m_Sender    = sender;
     m_SkillInfo = info;
 }
 public SkillInstance FindInnerSkillInstanceForSkillViewer(int skillId, SkillInstance innerInstance, out GfxSkillSenderInfo sender)
 {
     SkillInstance ret = null;
     SkillLogicInfo logicInfo = m_SkillLogicInfos.Find(info => info.SkillId == skillId && info.SkillInst.InnerDslSkillId == innerInstance.InnerDslSkillId && info.SkillInst.OuterDslSkillId == innerInstance.OuterDslSkillId);
     if (null != logicInfo) {
         sender = logicInfo.Sender;
         ret = logicInfo.SkillInst;
     } else {
         int newSkillId = CalcUniqueInnerSkillId(skillId, innerInstance);
         sender = null;
         var instInfo = GetUnusedSkillInstanceInfoFromPool(newSkillId);
         if (null != instInfo) {
             ret = instInfo.m_SkillInstance;
         }
     }
     return ret;
 }
 public SkillInstance FindSkillInstanceForSkillViewer(int skillId, out GfxSkillSenderInfo sender)
 {
     SkillInstance ret = null;
     SkillLogicInfo logicInfo = m_SkillLogicInfos.Find(info => info.SkillId == skillId);
     if (null != logicInfo) {
         sender = logicInfo.Sender;
         ret = logicInfo.SkillInst;
     } else {
         sender = null;
         var instInfo = GetUnusedSkillInstanceInfoFromPool(skillId);
         if (null != instInfo) {
             ret = instInfo.m_SkillInstance;
         }
     }
     return ret;
 }
 public SkillInstance GetActiveSkillInfo(int index, out GfxSkillSenderInfo sender)
 {
     int ct = m_SkillLogicInfos.Count;
     if (index >= 0 && index < ct) {
         var info = m_SkillLogicInfos[index];
         sender = info.Sender;
         return info.SkillInst;
     } else {
         sender = null;
         return null;
     }
 }
 public SkillLogicInfo(GfxSkillSenderInfo sender, SkillInstanceInfo info)
 {
     m_Sender = sender;
     m_SkillInfo = info;
 }