Ejemplo n.º 1
0
        /// <summary>
        /// 技能攻击点击
        /// </summary>
        /// <param name="gameEventBase"></param>
        private void OnSkillButtonClick(GameEventBase gameEventBase)
        {
            SkillButtonClickGameEvent skillButtonClickGameEvent = (SkillButtonClickGameEvent)gameEventBase;

            ActiveSkillComponent    activeSkillComponent    = Owner.GetUnitComponent <ActiveSkillComponent>();
            CharacterStateComponent characterStateComponent = Owner.GetUnitComponent <CharacterStateComponent>();

            if (activeSkillComponent == null || characterStateComponent == null)
            {
                return;
            }

            //无法控制状态
            if (characterStateComponent.Get(SpecialStateType.NotInControl))
            {
                return;
            }

            if (skillButtonClickGameEvent.IsNormalClick)
            {
                //skillButtonClickGameEvent.SkillId;
                Debug.Log("原地放技能");
                activeSkillComponent.Verify(skillButtonClickGameEvent.SkillId, (PlayerBase)Owner, null, Trigskill, null, Complate);
            }
            else
            {
                Vector3 targetDir = new Vector3(skillButtonClickGameEvent.Postion.x, 0, skillButtonClickGameEvent.Postion.y);
                targetDir = targetDir.GetRotateY(GameEntry.Camera.MainCamera.transform.eulerAngles.y);
                Owner.SelfTransform.rotation = Quaternion.LookRotation(targetDir);
                Debug.Log("改变方向放技能");
                activeSkillComponent.Verify(skillButtonClickGameEvent.SkillId, (PlayerBase)Owner, null, Trigskill, null, Complate);
            }
        }
Ejemplo n.º 2
0
        private void Complate(Skill skill)
        {
            m_skill = null;
            CharacterStateComponent characterStateComponent = Owner.GetUnitComponent <CharacterStateComponent>();

            characterStateComponent.Set(SpecialStateType.NotInControl, false);
            Debug.Log("技能结束");
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 检验技能完毕 触发技能
        /// </summary>
        /// <param name="skill">触发的技能</param>
        private void Trigskill(Skill skill)
        {
            ActiveSkillComponent activeSkillComponent = Owner.GetUnitComponent <ActiveSkillComponent>();

            if (skill == null)
            {
                return;
            }

            CharacterStateComponent characterStateComponent = Owner.GetUnitComponent <CharacterStateComponent>();

            characterStateComponent.Set(SpecialStateType.NotInControl, true);

            GameEntry.Event.CommonEvent.Dispatch(this, GameEntry.Pool.SpawnClassObject <SkillCDGameEvent>().Fill(skill.SkillData.SkillId, null));

            if (skill.SkillData.SkillId == 10013)
            {
                Owner.GetUnitComponent <BuffComponent>().AddBuff(0);
            }
            activeSkillComponent.HandleCast(skill, 0);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 普通攻击点击
        /// </summary>
        /// <param name="gameEventBase"></param>
        private void OnNormalAttakClick(GameEventBase gameEventBase)
        {
            Debug.Log("普攻");
            CharacterStateComponent characterStateComponent = Owner.GetUnitComponent <CharacterStateComponent>();
            ActiveSkillComponent    activeSkillComponent    = Owner.GetUnitComponent <ActiveSkillComponent>();

            if (characterStateComponent.Get(SpecialStateType.NotInControl))
            {
                return;
            }

            int skillId = 0;

            if (characterStateComponent.Get(SpecialStateType.PowerAttack))
            {
                skillId = m_SkillIndex[powerindex];
                powerindex++;
                if (powerindex > 7)
                {
                    powerindex = 5;
                }
            }
            else
            {
                skillId = m_SkillIndex[index];
                index++;
                if (index > 4)
                {
                    index = 1;
                }
            }



            activeSkillComponent.Verify(skillId, (PlayerBase)Owner, null, Trigskill, null, Complate);
        }