コード例 #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);
            }
        }
コード例 #2
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);
        }