Example #1
0
        public SkillFullInfo GetDefaultSkill()
        {
            var sd = Util.GetSkillData(GetDefaultSkillId(), GetDefaultSkillLevel());
            var sk = new SkillFullInfo(sd);

            return(sk);
        }
Example #2
0
        void UpdateFrame()
        {
            foreach (var c in cells)
            {
                GameObject.Destroy(c);
            }
            cells.Clear();

            gNum.text = "技能点:" + GameInterface_Skill.skillInterface.GetLeftSp();
            var skillList = GameInterface_Skill.skillInterface.GetActiveSkill();

            for (int i = 0; i < skillList.Count; i++)
            {
                var data = skillList[i];
                var nc   = GameObject.Instantiate(cell) as GameObject;
                nc.SetActive(true);
                nc.transform.parent = cell.transform.parent;
                Util.InitGameObject(nc);

                var c            = nc.GetComponent <SkillCell>();
                var nextLevSkill = Util.GetSkillData(data.skillId, data.level + 1);
                c.SetSkillName(data.skillId, data.skillData.SkillName, data.level, nextLevSkill.LevelRequired, data.skillData.SkillDes, data.skillData.MaxLevel);

                c.SetCb(delegate() {
                    GameInterface_Skill.skillInterface.SkillLevelUp(data.skillId);
                });
                cells.Add(nc);
            }

            grid.repositionNow = true;
        }
Example #3
0
        /// <summary>
        ///怪物随机一个技能
        /// </summary>
        public void SetRandomActive()
        {
            Log.AI("SetRandomActive " + gameObject.name);
            var rd     = UnityEngine.Random.Range(0, 100);
            var skList = attribute.ObjUnitData.GetSkillList();

            Log.AI("skList is " + skList.Count);
            foreach (SimpleJSON.JSONNode j in skList)
            {
                if (string.IsNullOrEmpty(j ["ignore"].Value) && rd >= j ["min"].AsInt && rd < j ["max"].AsInt)
                {
                    var tp = Type.GetType("MyLib.Skill" + j ["id"].AsInt);
                    if (tp == null)
                    {
                        activeSkill = Util.GetSkillData(j ["id"].AsInt, j ["level"].AsInt);
                        Log.AI("Set Random Skill Active " + activeSkill.SkillName);
                        return;
                    }
                    else
                    {
                        //技能有额外的条件需要检测
                        var sk  = (SkillObj)Activator.CreateInstance(tp);
                        var ret = sk.CheckCondition(gameObject);
                        Log.AI("CheckSkillCondition " + j ["id"].Value);
                        if (ret)
                        {
                            activeSkill = Util.GetSkillData(j ["id"].AsInt, j ["level"].AsInt);
                            Log.AI("Set Random Skill Active " + activeSkill.SkillName);
                            return;
                        }
                    }
                }
            }
            SetDefaultActive();
        }
Example #4
0
        public override string GetSkillName()
        {
            var skId   = this.GetDefaultSkill();
            var skData = Util.GetSkillData(skId, 1);

            return(skData.SkillName);
        }
Example #5
0
        /// <summary>
        ///检查是否释放冲击技能
        /// </summary>
        /// <returns>The rush.</returns>
        IEnumerator CheckRush()
        {
            var commonAI = GetComponent <CommonAI>();

            while (true)
            {
                var target = commonAI.targetPlayer;
                var state  = ai.state.type;
                if (target != null && !target.GetComponent <NpcAttribute>().IsDead&& state == AIStateEnum.COMBAT)
                {
                    var diff = Util.XZSqrMagnitude(transform.position, target.transform.position);
                    Log.Sys("Skill117 diff " + diff);
                    //距离适中冲刺
                    if (diff > 25 && diff < 100)
                    {
                        var msg = new MyAnimationEvent.Message();
                        msg.type = MyAnimationEvent.MsgType.DoSkill;
                        var sd = Util.GetSkillData(141, 1);
                        msg.skillData = sd;
                        GetComponent <MyAnimationEvent>().InsertMsg(msg);
                    }
                }
                yield return(new WaitForSeconds(2));
            }
        }
Example #6
0
        public static void RemoveSkillBuff(GameObject who, int skillId)
        {
            var skill     = Util.GetSkillData(skillId, 1);
            var skillInfo = SkillLogic.GetSkillInfo(skill);
            var evt       = skillInfo.eventList [0];

            who.GetComponent <BuffComponent>().RemoveBuff(evt.affix.effectType);
        }
Example #7
0
        public static void AddStaticShootBuff(GameObject who, int skillId, Vector3 pos)
        {
            var skill     = Util.GetSkillData(skillId, 1);
            var skillInfo = SkillLogic.GetSkillInfo(skill);
            var evt       = skillInfo.eventList[0];

            NetDateInterface.FastAddBuff(evt.affix, who, who, skillId, evt.EvtId);
        }
Example #8
0
        //所有命令执行函数需要注意命令执行结束的时候 设定当前命令为null
        void EnterUseSkill(ObjectCommand cmd)
        {
            //判断是否可以使用技能
            var msg = new MyAnimationEvent.Message(MyAnimationEvent.MsgType.DoSkill);

            msg.skillData = Util.GetSkillData(cmd.skillId, cmd.skillLevel);
            GetComponent <MyAnimationEvent>().InsertMsg(msg);
            currentLogicCommand = null;
        }
Example #9
0
        public static bool AddSkillBuff(GameObject who, int skillId, Vector3 pos)
        {
            var skill     = Util.GetSkillData(skillId, 1);
            var skillInfo = SkillLogic.GetSkillInfo(skill);
            var evt       = skillInfo.eventList [0];
            var ret       = who.GetComponent <BuffComponent>().AddBuff(evt.affix, pos);

            return(ret);
        }
Example #10
0
        /// <summary>
        /// 和使用普通技能一样
        /// </summary>
        public void PlayerAttack()
        {
            //连击3招
            var skillId   = ObjectManager.objectManager.GetMyPlayer().GetComponent <SkillInfoComponent> ().GetDefaultSkillId();
            var skillData = Util.GetSkillData(skillId, 1);

            ObjectManager.objectManager.GetMyPlayer().GetComponent <MyAnimationEvent>().OnSkill(skillData);

            NetDateInterface.FastMoveAndPos();
            NetDateInterface.FastUseSkill(skillId, skillData.Level);
        }
Example #11
0
        //TODO:初始化快捷键上面的技能数据,不包含等级等数据
        public SkillFullInfo(int skId, int index)
        {
            var sinfo = ShortCutInfo.CreateBuilder();

            sinfo.Index  = index;
            sinfo.BaseId = skId;
            sinfo.Type   = 0;
            shortInfo    = sinfo.BuildPartial();

            skillData = Util.GetSkillData(skId, 1);
        }
Example #12
0
 void OnEvent(MyEvent evt)
 {
     if (evt.type == MyEvent.EventType.HitTarget)
     {
         var target = evt.target;
         //在目标身上立即添加这个武器Buff造成的伤害Buff
         //Hurt Direct 但是伤害数值0 WeaponDamagePCT= 0
         var skmachine = SkillLogic.CreateSkillStateMachine(obj,
                                                            Util.GetSkillData(
                                                                System.Convert.ToInt32(affix.GetPara(PairEnum.Abs)), 1), Vector3.zero, target);
     }
 }
Example #13
0
 protected override bool CheckEventOverride(MyAnimationEvent.Message msg)
 {
     Log.AI("CheckEventOverride " + msg.type);
     if (msg.type == MyAnimationEvent.MsgType.BOMB)
     {
         Log.AI("CheckBombEvent " + msg.type);
         var sdata = Util.GetSkillData(137, 1);
         aiCharacter.GetAttr().StartCoroutine(SkillLogic.MakeSkill(aiCharacter.GetAttr().gameObject, sdata, GetAttr().transform.position));
         aiCharacter.ChangeState(AIStateEnum.DEAD);
         return(true);
     }
     return(base.CheckEventOverride(msg));
 }
Example #14
0
        public static bool AddBuffWithNet(GameObject who, int skillId, Vector3 pos, int pid = 0)
        {
            var skill     = Util.GetSkillData(skillId, 1);
            var skillInfo = SkillLogic.GetSkillInfo(skill);
            var evt       = skillInfo.eventList [0];

            //var ret = who.GetComponent<BuffComponent>().AddBuff(evt.affix, pos, pid);
            //if (ret)
            {
                NetDateInterface.FastAddBuff(evt.affix, who, who, skillId, evt.EvtId);
            }
            //return ret;
            return(true);
        }
Example #15
0
 public void OnCommand(ObjectCommand cmd)
 {
     lastCmd = cmd;
     if (cmd.commandID == ObjectCommand.ENUM_OBJECT_COMMAND.OC_USE_SKILL)
     {
         var skillData = Util.GetSkillData(cmd.skillId, cmd.skillLevel);
         var skillPart = GetSkill();
         skillPart.SetActiveSkill(skillData);
         ChangeState(AIStateEnum.CAST_SKILL);
     }
     else if (cmd.commandID == ObjectCommand.ENUM_OBJECT_COMMAND.OC_MOVE)
     {
         ChangeState(AIStateEnum.MOVE);
     }
 }
Example #16
0
        public static void LearnSkill(int skillId)
        {
            Log.Net("LearnSkill: " + skillId);
            var pinfo    = ServerData.Instance.playerInfo;
            var allSkill = pinfo.Skill;
            var skInfo   = SkillInfo.CreateBuilder();

            skInfo.SkillInfoId = skillId;
            skInfo.Level       = 1;
            skInfo.Pos         = 0;
            allSkill.SkillInfosList.Add(skInfo.Build());
            var skData = Util.GetSkillData(skillId, 1);

            SendNotify("恭喜学会技能 [ff1010]" + skData.SkillName + "[-]");
        }
Example #17
0
        public void NetworkBuff(GCPlayerCmd cmd)
        {
            var sk       = Util.GetSkillData(cmd.BuffInfo.SkillId, 1);
            var skConfig = SkillLogic.GetSkillInfo(sk);
            var evt      = skConfig.GetEvent(cmd.BuffInfo.EventId);

            if (evt != null)
            {
                var pos = cmd.BuffInfo.AttackerPosList;
                var px  = pos [0] / 100.0f;
                var py  = pos [1] / 100.0f;
                var pz  = pos [2] / 100.0f;
                gameObject.GetComponent <BuffComponent>().AddBuff(evt.affix, new Vector3(px, py, pz));
            }
        }
Example #18
0
        public void SetDefaultActive()
        {
            var buff = GetComponent <BuffComponent>();
            var bs   = buff.GetBuffSkill();

            if (bs != 0)
            {
                var sd = Util.GetSkillData(bs, 1);
                activeSkill             = sd;
                activeSkill.IsBuffSkill = true;
            }
            else
            {
                activeSkill = GetDefaultSkill().skillData;
            }
        }
Example #19
0
        /// <summary>
        ///得到怪物的死亡随机技能
        /// </summary>
        /// <returns>The dead skill.</returns>
        public SkillData  GetDeadSkill()
        {
            var skList = attribute.ObjUnitData.GetSkillList();

            foreach (SimpleJSON.JSONNode j in skList)
            {
                if (!string.IsNullOrEmpty(j ["death"].Value))
                {
                    if (j ["death"].AsBool)
                    {
                        activeSkill = Util.GetSkillData(j ["id"].AsInt, j ["level"].AsInt);
                        Log.AI("Set Death Skill Active " + activeSkill.SkillName);
                        return(activeSkill);
                    }
                }
            }
            return(null);
        }
Example #20
0
 protected override void OnEvent(MyEvent evt)
 {
     if (evt.type == MyEvent.EventType.WolfCall)
     {
         if (evt.localID != attribute.GetLocalId())
         {
             GetComponent <CommonAI>().targetPlayer = evt.target;
             var diff = Util.XZSqrMagnitude(evt.target.transform.position, transform.position);
             if (diff > 25)
             {
                 var aniEvent  = myAnimationEvent;
                 var skillData = Util.GetSkillData(117, 1);
                 aniEvent.InsertMsg(new MyAnimationEvent.Message(MyAnimationEvent.MsgType.IDLE));
                 aniEvent.OnSkill(skillData);
             }
         }
     }
 }
Example #21
0
        /// <summary>
        ///检查是否释放冲击技能
        /// </summary>
        /// <returns>The rush.</returns>
        IEnumerator CheckRush()
        {
            var commonAI = GetComponent <CommonAI>();

            while (true)
            {
                var target = commonAI.targetPlayer;
                var state  = ai.state.type;
                if (target != null && !target.GetComponent <NpcAttribute>().IsDead&& state == AIStateEnum.COMBAT)
                {
                    var msg = new MyAnimationEvent.Message();
                    msg.type = MyAnimationEvent.MsgType.DoSkill;
                    var sd = Util.GetSkillData(142, 1);
                    msg.skillData = sd;
                    GetComponent <MyAnimationEvent>().InsertMsg(msg);
                }
                yield return(new WaitForSeconds(5));
            }
        }
Example #22
0
        IEnumerator DamageNear()
        {
            while (!IsDie)
            {
                yield return(new WaitForSeconds(3));

                BackgroundSound.Instance.PlayEffect("skill/fireimp1");
                var stateMachine = SkillLogic.CreateSkillStateMachine(obj, Util.GetSkillData(129, 1), obj.transform.position, null);
                if (affix.fireParticle != null)
                {
                    var evt = new MyEvent(MyEvent.EventType.SpawnParticle);
                    evt.particleOffset = new Vector3(0, 1, 0);
                    evt.particle2      = affix.fireParticle;
                    evt.boneName       = null;
                    evt.player         = obj;
                    MyEventSystem.myEventSystem.PushEvent(evt);
                }
            }
        }
Example #23
0
        //为玩家增加Buff
        void OnTriggerEnter(Collider other)
        {
            if (NetworkUtil.IsNetMaster())
            {
                if (other.tag == GameTag.Player)
                {
                    //击退技能
                    var pos     = other.transform.position;
                    var otherGo = other.gameObject;

                    var skill     = Util.GetSkillData(140, 1);
                    var skillInfo = SkillLogic.GetSkillInfo(skill);
                    var evt       = skillInfo.eventList[0];
                    var ret       = gameObject.GetComponent <BuffComponent>().AddBuff(evt.affix, pos);
                    if (ret)
                    {
                        NetDateInterface.FastAddBuff(evt.affix, otherGo, gameObject, skill.Id, evt.EvtId);
                    }
                }
            }
        }
Example #24
0
        /// <summary>
        /// 获得一个当前存在条件约束的可以使用的技能
        /// 闪烁技能
        /// Random
        /// ignore
        /// </summary>
        /// <returns>The random skill.</returns>
        public SkillData GetRandomSkill()
        {
            Log.AI("SetRandomActive " + gameObject.name);
            var rd     = UnityEngine.Random.Range(0, 100);
            var skList = attribute.ObjUnitData.GetSkillList();

            Log.AI("skList is " + skList.Count);
            foreach (SimpleJSON.JSONNode j in skList)
            {
                if (!string.IsNullOrEmpty(j ["ignore"].Value))
                {
                    if (rd < j ["chance"].AsInt)
                    {
                        var tp = Type.GetType("MyLib.Skill" + j ["id"].AsInt);
                        if (tp == null)
                        {
                        }
                        else
                        {
                            var t        = typeof(NGUITools);
                            var m        = t.GetMethod("AddMissingComponent");
                            var geMethod = m.MakeGenericMethod(tp);
                            var sk       = geMethod.Invoke(null, new object[] { gameObject }) as SkillObj;

                            //技能有额外的条件需要检测
                            //var sk = (SkillObj)Activator.CreateInstance(tp);
                            var ret = sk.CheckCondition(gameObject);
                            Log.AI("CheckSkillCondition " + j ["id"].Value);
                            if (ret)
                            {
                                return(Util.GetSkillData(j ["id"].AsInt, j ["level"].AsInt));
                            }
                        }
                    }
                }
            }
            return(null);
        }
Example #25
0
        void OnTriggerEnter(Collider other)
        {
            Log.Sys("MoveBlock Enter : " + other.gameObject);
            if (NetworkUtil.IsNetMaster())
            {
                if (other.tag == GameTag.Player)
                {
                    //击退技能
                    var pos     = other.transform.position;
                    var otherGo = other.gameObject;
                    //dy dx 比较 那个大 保留那个 同时另外一个修正为 自己的pos
                    var par   = transform.parent.gameObject;
                    var myPos = par.transform.position;

                    //假设箱子都是 正方体
                    var dx = myPos.x - pos.x;
                    var dz = myPos.z - pos.z;
                    if (Mathf.Abs(dx) < Mathf.Abs(dz))
                    {
                        pos.x = myPos.x;
                    }
                    else
                    {
                        pos.z = myPos.z;
                    }

                    var skill     = Util.GetSkillData((int)SkillData.SkillConstId.KnockBack, 1);
                    var skillInfo = SkillLogic.GetSkillInfo(skill);
                    var evt       = skillInfo.eventList [0];
                    var ret       = par.GetComponent <BuffComponent>().AddBuff(evt.affix, pos);
                    if (ret)
                    {
                        NetDateInterface.FastAddBuff(evt.affix, otherGo, par, skill.Id, evt.EvtId, pos);
                    }
                }
            }
        }
Example #26
0
        /// <summary>
        /// 初始化特定事件发生时候的技能层
        /// 或者 创建孩子技能
        /// </summary>
        /// <param name="item">Item.</param>
        /// <param name="evt">Evt.</param>
        void InitLayout(SkillDataConfig.EventItem item, MyEvent evt)
        {
            if (item.layout != null)
            {
                var g = Instantiate(item.layout) as GameObject;
                g.transform.parent = transform;

                //陷阱粒子效果 位置是 当前missile爆炸的位置
                //瞬间调整SkillLayout的方向为 攻击者的正方向
                g.transform.localPosition = InitPos;
                float y;
                if (forwardSet)
                {
                    y = Quaternion.LookRotation(forwardDir).eulerAngles.y;
                }
                else
                {
                    y = attacker.transform.localRotation.eulerAngles.y;
                }
                g.transform.localRotation = Quaternion.Euler(new Vector3(0, y, 0));
                g.transform.localScale    = Vector3.one;


                var runner = g.AddComponent <SkillLayoutRunner>();
                runner.stateMachine = this;
                runner.Event        = item;
                runner.triggerEvent = evt;
                allRunners.Add(g);
                Log.AI("SkillLayout " + item.layout.name);
            }
            else if (item.childSkillId != 0 && item.childSkillId != -1)
            {
                Log.AI("Create Child Skill " + item.childSkillId);
                SkillLogic.CreateSkillStateMachine(attacker, Util.GetSkillData(item.childSkillId, 1), evt.missile.position);
            }
        }
Example #27
0
 //TODO:快捷键技能的信息 需要通过ShortCutInfo和普通的SkillInfo 来初始化 获得技能的等级信息
 //TODO:根据快捷键信息 初始化技能信息 或者 使用道具药品的信息
 public SkillFullInfo(ShortCutInfo sh)
 {
     shortInfo = sh;
     skillData = Util.GetSkillData(sh.BaseId, 1);
     //Pos = sh.Index;
 }
Example #28
0
 public SkillFullInfo(SkillInfo sk)
 {
     skillData = Util.GetSkillData(sk.SkillInfoId, sk.Level);
 }
Example #29
0
 public void SetLevel(int lev)
 {
     skillData = Util.GetSkillData(skillId, lev);
 }
Example #30
0
 public SkillFullInfo(GCPushActivateSkill p)
 {
     skillData = Util.GetSkillData(p.SkillId, p.Level);
 }