private void PrepareCastSelectedSkill(SkillCfg selectedSkillCfg, Transform targetTf, Vector3 hitPos)
        {
            switch (selectedSkillCfg.mTargetType)
            {
            case SkillTargetType.Actor:
            {
                var target = targetTf.GetComponent <GameActor>();
                if (null != target)
                {
                    LogDC.Log("find actor");
                    GetCastCfg().SetTargetActor(target);

                    var distance = Toolkit.ComputeDistance(targetTf, CacheTransform);
                    if (distance > selectedSkillCfg.mCastRange)
                    {
                        MoveCmpt.Move(MoveType.NavTarget, target.CacheTransform, mHeroCfg.mSpeed,
                                      selectedSkillCfg.mCastRange);
                    }
                }
            }
            break;

            case SkillTargetType.Direction:
            {
                //计算一个方向,并且平行于地面。让y值都为0
                hitPos.y = 0;
                var playerPos = CacheTransform.position;
                playerPos.y = 0;
                var rawDirection = (hitPos - playerPos).normalized;
                GetCastCfg().SetDirection(rawDirection);
            }
            break;

            case SkillTargetType.Position:
            {
                var playerPos = CacheTransform.position;
                hitPos.y = 0;
                GetCastCfg().SetTargetPosition(hitPos);

                var distance = Vector3.Distance(hitPos, playerPos);
                if (distance > selectedSkillCfg.mCastRange)
                {
                    var miniatureValue = mSelectedSkillCfg.mCastRange.MiniatureValue();
                    LogDC.LogEx("trace pos ", hitPos, miniatureValue);
                    MoveCmpt.Move(MoveType.NavPos, hitPos, GetSpeed(), miniatureValue);
                }
            }
            break;
            }
        }
        public override void Act(object data)
        {
            base.Act(data);
            //如果是持续施法中,忽略其他
            var lastSkill = Caster.GetLastSkill();

            if (null != lastSkill && lastSkill.GetSkillCfg().mCastType == CastType.persistently &&
                !lastSkill.IsComplete())
            {
                return;
            }

            //if 选好了技能和目标 尝试施法
            var skillCfg = Hero.GetSelectedSkillCfg();
            var castCfg  = Hero.GetCastCfg();

            if (null != skillCfg && null != castCfg && castCfg.mPrepared)
            {
                var casterTf = Hero.CacheTransform;
                var hit      = Hero.mCastTargetHit;
                //检查各种条件
                //距离
                switch (skillCfg.mTargetType)
                {
                case SkillTargetType.Position:
                {
                    var distance = Vector3.Distance(hit.point, casterTf.position);
                    LogDC.LogEx("wait for position", distance, skillCfg.mCastRange);
                    if (distance <= skillCfg.mCastRange)
                    {
                        Caster.Cast(skillCfg, castCfg);
                        Hero.ClearSkill();
                    }

                    break;
                }

                case SkillTargetType.Actor:
                {
                    var distance = Toolkit.ComputeDistance(hit.transform, casterTf);
                    LogDC.LogEx("wait for position", distance, skillCfg.mCastRange);
                    if (distance <= skillCfg.mCastRange)
                    {
                        Caster.Cast(skillCfg, castCfg);
                        Hero.ClearSkill();
                    }

                    break;
                }

                case SkillTargetType.Direction:
                {
                    var hitPos       = hit.point;
                    var hitGroundPos = new Vector3(hitPos.x, 0, hitPos.z);
                    var playerPos    = Hero.CacheTransform.position;
                    var rawDirection = (hitGroundPos - playerPos).normalized;

                    Caster.Cast(skillCfg, castCfg);
                    Hero.ClearSkill();

                    break;
                }
                }
            }
        }