private bool CheckCostToSpanSkill()
        {
            this.SkillDesNodeData = (SkillDesNodeData)this.BelongtoRuntimeTree.BelongNP_DataSupportor.BuffNodeDataDic[this.DataId.Value];
            //TODO 相关状态检测,例如沉默,眩晕等,下面是示例代码

            /*
             * if (Game.Scene.GetComponent<UnitComponent>().Get(this.Unitid).GetComponent<BuffManagerComponent>()
             *      .FindBuffByWorkType(BuffWorkTypes.Silence))
             * {
             *  return false;
             * }
             */
            //给要修改的黑板节点进行赋值
            HeroDataComponent heroDataComponent = Game.Scene.GetComponent <UnitComponent>().Get(this.Unitid).GetComponent <HeroDataComponent>();

            switch (this.SkillDesNodeData.SkillCostTypes)
            {
            case SkillCostTypes.MagicValue:
                //依据技能具体消耗来进行属性改变操作
                return(true);

            case SkillCostTypes.Other:
                return(true);

            case SkillCostTypes.HPValue:
                return(true);

            default:
                return(true);
            }
        }
Exemplo n.º 2
0
        public void ChangeUnitProperty()
        {
            HeroDataComponent heroDataComponent = Game.Scene.GetComponent <UnitComponent>().Get(this.Unitid).GetComponent <HeroDataComponent>();

            switch (BuffWorkTypes)
            {
            case BuffWorkTypes.ChangeMagic:
                float tobeReMagicValue = this.BelongtoRuntimeTree.GetBlackboard().Get <float>(this.NPBalckBoardRelationData.BBKey);
                heroDataComponent.CurrentMagicValue -= tobeReMagicValue;
                try
                {
                    Game.EventSystem.Run(EventIdType.ChangeMP, this.Unitid, -tobeReMagicValue);
                }
                catch (Exception e)
                {
                    Log.Error(e);
                    throw;
                }

                // Log.Info(
                //     $"减少了蓝:{((float) Game.Scene.GetComponent<UnitComponent>().Get(this.Unitid).GetComponent<NP_RuntimeTreeManager>().GetTreeByRuntimeID(this.RuntimeTreeID).GetBlackboard()[m_NPBalckBoardRelationData.DicKey]).ToString()}");
                break;

            case BuffWorkTypes.ChangeHP:
                heroDataComponent.CurrentLifeValue -= this.BelongtoRuntimeTree.GetBlackboard().Get <float>(this.NPBalckBoardRelationData.BBKey);
                break;
            }
        }
Exemplo n.º 3
0
        private bool CheckCostToSpanSkill()
        {
            this.SkillDesNodeData = (SkillDesNodeData)this.BelongtoRuntimeTree.BelongNP_DataSupportor.BuffNodeDataDic[this.DataId.Value];
            // 相关状态检测,例如沉默,眩晕等,下面是示例代码

            if (Game.Scene.GetComponent <UnitComponent>().Get(this.Unitid).GetComponent <StackFsmComponent>()
                .CheckConflictState(ConfliectType))
            {
                return(false);
            }

            //给要修改的黑板节点进行赋值
            HeroDataComponent heroDataComponent = UnitComponent.Instance.Get(this.Unitid).GetComponent <HeroDataComponent>();

            switch (this.SkillDesNodeData.SkillCostTypes)
            {
            case SkillCostTypes.MagicValue:
                //依据技能具体消耗来进行属性改变操作
                return(true);

            case SkillCostTypes.Other:
                return(true);

            case SkillCostTypes.HPValue:
                return(true);

            default:
                return(true);
            }
        }
Exemplo n.º 4
0
        public void ChangeUnitProperty()
        {
            Unit unit = UnitComponent.Instance.Get(this.Unitid);
            HeroDataComponent     heroDataComponent = unit.GetComponent <HeroDataComponent>();
            DataModifierComponent dataModifierComponent = unit.GetComponent <DataModifierComponent>();
            float oriValue, finalValue;

            switch (BuffWorkTypes)
            {
            case BuffWorkTypes.ChangeMagic:
                oriValue   = this.BelongtoRuntimeTree.GetBlackboard().Get <float>(this.NPBalckBoardRelationData.BBKey);
                finalValue = dataModifierComponent.BaptismData("CostMP", oriValue);

                unit.GetComponent <NumericComponent>()[NumericType.Mp] += finalValue;
                // Log.Info(
                //     $"减少了蓝:{((float) UnitComponent.Instance.Get(this.Unitid).GetComponent<NP_RuntimeTreeManager>().GetTreeByRuntimeID(this.RuntimeTreeID).GetBlackboard()[m_NPBalckBoardRelationData.DicKey]).ToString()}");
                break;

            case BuffWorkTypes.ChangeHP:
                oriValue   = this.BelongtoRuntimeTree.GetBlackboard().Get <float>(this.NPBalckBoardRelationData.BBKey);
                finalValue = dataModifierComponent.BaptismData("CostHP", oriValue);

                unit.GetComponent <NumericComponent>()[NumericType.Hp] += finalValue;
                break;
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 根据移速矫正动画播放
        /// </summary>
        public void PlayRunAnimationByMoveSpeed()
        {
            if (this.Entity.GetComponent <StackFsmComponent>().GetCurrentFsmState().StateTypes != StateTypes.Run)
            {
                return;
            }

            HeroDataComponent heroDataComponent = this.Entity.GetComponent <HeroDataComponent>();
            float             animSpeed         = heroDataComponent.GetAttribute(NumericType.Speed) / heroDataComponent.GetAttribute(NumericType.SpeedBase);

            this.Entity.GetComponent <AnimationComponent>().PlayAnimByStackFsmCurrent(0.3f, animSpeed);
        }
        private async ETTask CommonAttack_Internal(Unit targetUnit, CancellationTokenSource cancellationTokenSource)
        {
            HeroDataComponent heroDataComponent = this.Entity.GetComponent <HeroDataComponent>();
            float             attackPre         = heroDataComponent.NodeDataForHero.OriAttackPre / (1 + heroDataComponent.GetAttribute(NumericType.AttackSpeedAdd));
            float             attackSpeed       = heroDataComponent.GetAttribute(NumericType.AttackSpeed);

            //这里假设诺手原始攻击动画0.32s是动画攻击奏效点
            float animationAttackPoint = 0.32f;

            float animationSpeed = animationAttackPoint / attackPre;

            //播放动画,如果动画播放完成还不能进行下一次普攻,则播放空闲动画
            this.m_AnimationComponent.PlayAnimAndReturnIdelFromStart(StateTypes.CommonAttack, speed: animationSpeed);

            Game.Scene.GetComponent <SoundComponent>().PlayClip("Sound_Darius_NormalAttack", 0.4f).Coroutine();

            await TimerComponent.Instance.WaitAsync((long)(1 / attackSpeed * 1000), cancellationTokenSource.Token);
        }
        private async ETTask CommonAttack_Internal(Unit targetUnit, CancellationTokenSource cancellationTokenSource)
        {
            HeroDataComponent heroDataComponent = this.Entity.GetComponent <HeroDataComponent>();
            float             attackPre         = heroDataComponent.NodeDataForHero.OriAttackPre / (1 + heroDataComponent.NodeDataForHero.ExtAttackSpeed);
            float             attackSpeed       = heroDataComponent.NodeDataForHero.OriAttackSpeed + heroDataComponent.NodeDataForHero.ExtAttackSpeed;

            //这里假设诺手原始攻击动画0.32s是动画攻击奏效点
            float animationAttackPoint = 0.32f;

            float animationSpeed = animationAttackPoint / attackPre;

            //播放动画,如果动画播放完成还不能进行下一次普攻,则播放空闲动画
            this.m_AnimationComponent.PlayAnimAndReturnIdelFromStart(StateTypes.CommonAttack, speed: animationSpeed);

            await Game.Scene.GetComponent <TimerComponent>()
            .WaitAsync((long)(1 / attackSpeed * 1000), cancellationTokenSource.Token);

            //此次攻击完成
            this.CancellationTokenSource.Dispose();
            this.CancellationTokenSource = null;
        }