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

            return(sk);
        }
Exemplo n.º 2
0
        //TODO::支持单人副本和多人副本功能 取决于  是否直接通知MyAnimationEvent
        //根据技能信息和玩家信息 得到实际的 伤害  NpcAttribute  SkillFullInfo

        /*
         *      伤害计算过程
         *      1:伤害对象判定  客户端做
         *      2:伤害数值确定   服务端 或者客户端
         *      3:伤害效果施展 例如击退  服务端 或者 客户端
         */
        public static void DoDamage(GameObject attacker, SkillFullInfo skillData, GameObject enemy)
        {
            if (enemy.GetComponent <MyAnimationEvent>() != null)
            {
                var attribute = attacker.GetComponent <NpcAttribute>();
                //技能施展方是我方则可以计算技能伤害否则只做技能表现
                if (enemy.GetComponent <NpcAttribute>().IsMine())
                {
                    var  rd         = Random.Range(0, 100);
                    var  rate       = 1;
                    bool isCritical = false;
                    if (rd < attribute.GetCriticalRate())
                    {
                        rate       = 2;
                        isCritical = true;
                    }
                    //在基础攻击力上面提升的比例
                    var damage = (int)(attribute.Damage * (skillData.skillData.WeaponDamagePCT / 100.0f) * rate);
                    Log.Sys("calculate Damage Rate " + skillData.skillData.WeaponDamagePCT);

                    NetDateInterface.FastDamage(
                        attribute.GetComponent <KBEngine.KBNetworkView>().GetServerID(),
                        enemy.GetComponent <KBEngine.KBNetworkView>().GetServerID(),
                        damage,
                        isCritical
                        );

                    enemy.GetComponent <MyAnimationEvent>().OnHit(attacker, damage, isCritical);
                    var hitTarget = new MyEvent(MyEvent.EventType.HitTarget);
                    hitTarget.target = enemy;
                    hitTarget.skill  = skillData.skillData;
                    MyEventSystem.myEventSystem.PushLocalEvent(attribute.GetLocalId(), hitTarget);
                }
            }
        }
Exemplo n.º 3
0
 public override void EnterState()
 {
     base.EnterState();
     Log.AI("Enter Skill State ");
     //启动技能状态机 启动动画
     activeSkill       = GetAttr().GetComponent <SkillInfoComponent> ().GetActiveSkill();
     skillStateMachine = SkillLogic.CreateSkillStateMachine(GetAttr().gameObject, activeSkill.skillData, GetAttr().transform.position);
     //GetAttr ().GetComponent<AnimationController> ().SetAnimationSampleRate (100);
 }
Exemplo n.º 4
0
 public void UpdateShortcutsInfo(IList <ShortCutInfo> shortCutInfo)
 {
     skillSlots = new List <SkillFullInfo>();
     foreach (ShortCutInfo s in shortCutInfo)
     {
         var full = new SkillFullInfo(s);
         skillSlots.Add(full);
     }
     MyEventSystem.myEventSystem.PushEvent(MyEvent.EventType.UpdateShortCut);
 }
Exemplo n.º 5
0
        public override void EnterState()
        {
            base.EnterState();
            Log.AI("Enter Pet Skill State ");
            //启动技能状态机 启动动画
            activeSkill       = GetAttr().GetComponent <SkillInfoComponent>().GetActiveSkill();
            skillStateMachine = SkillLogic.CreateSkillStateMachine(GetAttr().gameObject, activeSkill.skillData, GetAttr().transform.position, null);

            SetAni(activeSkill.skillData.AnimationName, 1f, WrapMode.Once);
        }
Exemplo n.º 6
0
        //注册监听玩家的OnHit事件处理
        public override void EnterState()
        {
            Log.AI("Enter HumanCombat state");
            base.EnterState();

            pressAttack     = false;
            attackPressTime = Time.time;
            attackId        = 0;
            SetAttrState(CharacterState.Attacking);

            activeSkill = GetAttr().GetComponent <SkillInfoComponent>().GetActiveSkill();
        }
Exemplo n.º 7
0
        public override void EnterState()
        {
            base.EnterState();
            Log.AI("sentry Enter Skill State ");
            activeSkill       = GetAttr().GetComponent <SkillInfoComponent>().GetActiveSkill();
            skillStateMachine = SkillLogic.CreateSkillStateMachine(GetAttr().gameObject, activeSkill.skillData, GetAttr().transform.position, aiCharacter.GetEnemy());

            SetAni(activeSkill.skillData.AnimationName, 1f, WrapMode.Once);
            if (GetAttr().ObjUnitData.AttachToMaster)
            {
                GetAttr().StartCoroutine(TraceMaster());
            }
        }
Exemplo n.º 8
0
        void SetShortSkillData(int skId, int index)
        {
            foreach (SkillFullInfo s in skillSlots)
            {
                if (s.skillId == skId)
                {
                    skillSlots.Remove(s);
                    break;
                }
            }
            foreach (SkillFullInfo s in skillSlots)
            {
                if (s.shortSlotId == index)
                {
                    skillSlots.Remove(s);
                    break;
                }
            }
            var full = new SkillFullInfo(skId, index);

            skillSlots.Add(full);
            MyEventSystem.myEventSystem.PushEvent(MyEvent.EventType.UpdateShortCut);
        }
Exemplo n.º 9
0
        /// <summary>
        /// 初始化右下角的技能快捷栏
        /// 初始化技能列表
        /// </summary>
        /// <returns>The from network.</returns>
        public IEnumerator InitFromNetwork()
        {
            Log.Net("Init Skill slots");
            CGLoadShortcutsInfo.Builder b = CGLoadShortcutsInfo.CreateBuilder();
            KBEngine.PacketHolder       p = new KBEngine.PacketHolder();
            yield return(StartCoroutine(KBEngine.Bundle.sendSimple(this, b, p)));

            var shortData = p.packet.protoBody as GCLoadShortcutsInfo;

            skillSlots = new List <SkillFullInfo>();
            foreach (ShortCutInfo s in shortData.ShortCutInfoList)
            {
                var full = new SkillFullInfo(s);
                skillSlots.Add(full);
            }
            Log.Net("Init Skill slots over " + skillSlots.Count);
            MyEventSystem.myEventSystem.PushEvent(MyEvent.EventType.UpdateShortCut);


            Log.Sys("LoadSkillPanel");
            //获取特定技能面板的技能点 所有面板公用这些技能点
            CGLoadSkillPanel.Builder ls = CGLoadSkillPanel.CreateBuilder();
            ls.SkillSort = SkillSort.ACTIVE_SKILL;
            KBEngine.PacketHolder p2 = new KBEngine.PacketHolder();
            yield return(StartCoroutine(KBEngine.Bundle.sendSimple(this, ls, p2)));

            Log.Net("FinishLoad");
            var data = p2.packet.protoBody as GCLoadSkillPanel;

            //distributedSkillPoint = data.Distributed;
            if (data.HasTotalPoint)
            {
                totalSkillPoint = data.TotalPoint;
            }
            else
            {
                totalSkillPoint = 0;
            }
            Dictionary <int, SkillInfo> skIdToInfo = new Dictionary <int, SkillInfo>();

            Log.GUI("SkillInfoList " + data.SkillInfosList.Count + " totalPoint " + totalSkillPoint);

            foreach (SkillInfo sk in data.SkillInfosList)
            {
                skIdToInfo [sk.SkillInfoId] = sk;
            }

            var myJob = ChuMeng.ObjectManager.objectManager.GetMyJob();

            Log.Sys("SkillMyJob AndList " + myJob);
            //从服务器加载对应的技能数据 两部分: 配置的职业技能 服务器加载的技能
            foreach (var s in GameData.SkillConfig)
            {
                if (s.job == myJob)
                {
                    if (skIdToInfo.ContainsKey(s.id))
                    {
                        activeSkill.Add(new SkillFullInfo(skIdToInfo [s.id]));
                    }
                    else
                    {
                        var skInfo = SkillInfo.CreateBuilder();
                        skInfo.SkillInfoId = s.id;
                        skInfo.Level       = 0;
                        skInfo.Pos         = 0;
                        activeSkill.Add(new SkillFullInfo(skInfo.Build()));
                    }
                }
            }

            var learnedSkill = PlayerData.GetLearnedSkill();

            foreach (var s in learnedSkill.SkillInfosList)
            {
                var old = activeSkill.Find(item => item.skillId == s.SkillInfoId);
                if (old != null)
                {
                    //old.Pos = s.Pos;
                }
                else
                {
                    var skInfo = SkillInfo.CreateBuilder(s);
                    activeSkill.Add(new SkillFullInfo(skInfo.Build()));
                }
            }
            Log.Sys("MySkillCount " + activeSkill.Count);
        }