예제 #1
0
 public bool HasBounced(ISkillActor actor)
 {
     if (bouncedTargets == null || actor == null)
     {
         return(false);
     }
     return(bouncedTargets.Contains(actor));
 }
예제 #2
0
        public CommonParam CreateBuffParam(ISkillActor actor)
        {
            CommonParam param = new CommonParam(actor);

            buffIdentifyId++;
            AddSkillParam(buffIdentifyId, param, false);
            return(param);
        }
예제 #3
0
        public void AddTarget(ISkillActor actor)
        {
            if (actor == null)
            {
                SkillUtil.LogError("[SkillParam] target is null");
                return;
            }

            targets ??= new List <ISkillActor>();
            targets.Add(actor);
        }
예제 #4
0
 /// <summary>
 /// 设置弹射状态
 /// </summary>
 /// <param name="bBounce"></param>
 public void SetBounceState(bool bBounce, int actionId, int searchActionId)
 {
     this.bounceTime           = bBounce ? 1 : 0;
     this.bounceActionId       = actionId;
     this.searchTargetActionId = searchActionId;
     if (!bBounce)
     {
         this.bouncedTargets.Clear();
         this.lastBouncedActor = null;
     }
 }
예제 #5
0
        public virtual void Release()
        {
            if (buffIdentifyId != SkillDefine.NONE)
            {
                GetOwner().RemoveBuffParam(buffIdentifyId);
            }

            this.mOwner         = null;
            this.mTarget        = null;
            this.data           = null;
            this.buffIdentifyId = SkillDefine.NONE;
        }
예제 #6
0
 public void AddLastBouncedTarget(ISkillActor actor)
 {
     if (actor == null)
     {
         return;
     }
     if (bouncedTargets == null)
     {
         bouncedTargets = new List <ISkillActor>();
     }
     bouncedTargets.Add(actor);
     lastBouncedActor = actor;
 }
예제 #7
0
    public void BeginProjectile(ISkill skill, CommonParam param, SkillActionData data, ISkillActor actor, float speed)
    {
        if (skill == null || param == null || data == null || actor == null)
        {
            SkillUtil.LogError("Null Param");
            return;
        }

        this.mSkill    = skill;
        this.mParam    = param;
        this.mActor    = actor;
        this.mData     = data;
        this.startTime = Time.unscaledTime;
        var type = (SkillActionType)data.ActionType;

        this.mIsFollowProjectile = type == SkillActionType.FollowProjectile;
        this.lastDir             = Vector3.zero;
        this.mSpeed         = speed;
        this.casterPosition = mSkill.GetContext().GetSelfActor().GetTransform().position;

        if (this.mIsFollowProjectile)
        {
            mCanBlink = data.Para4 == "1";
        }
        else
        {
            mDeleteAfterHit = data.Para4 == "1";
            SkillUtil.TryParseWithDebug(data.Para5, out mMinRadiusRange, "线性投射起始范围");
            SkillUtil.TryParseWithDebug(data.Para5, out mMaxRadiusRange, "线性投射结束范围");
            SkillUtil.TryParseWithDebug(data.Para5, out mMaxDistance, "线性投射固定距离");
        }

        // this.mSpeed = 350; //low speed for test
        //Debug.LogError("SetTarget->" + mActor.GetTransform().name);
        this.transform.LookAt(mActor.GetTransform().position);
        mRigidBody.AddForce(this.transform.forward * this.mSpeed);
    }
예제 #8
0
 public virtual void Create(ISkill skill, ISkillActor target, int buffId)
 {
     this.mOwner  = skill;
     this.mTarget = target;
     this.data    = SkillUtil.GetSkillBuffData(buffId);
 }
예제 #9
0
 public CommonParam(ISkillActor actor)
 {
     this.actorClicked = actor;
 }
예제 #10
0
 public SkillComponent(ISkillActor actor) : base(actor)
 {
 }
예제 #11
0
        /// <summary>
        /// 弹射模式下的搜索
        /// </summary>
        /// <param name="context"></param>
        /// <param name="data"></param>
        /// <param name="param"></param>
        private void BounceSearch(ISkillContext context,
                                  SkillActionData data, CommonParam param)
        {
            if (data.Id != param.BounceParam.SearchTargetActionId)
            {
                return;
            }

            param.ResetTarget();
            var bounceData = SkillUtil.GetSkillActionData(param.BounceParam.BounceActionId);

            //弹射检查范围
            SkillUtil.TryParseWithDebug(bounceData.Para4, out int range, "弹射范围");
            bool isIgnoreRepeat = string.Equals("1", data.Para5);

            //todo  fake data,need real check
            var targetArrary = GameObject.FindObjectsOfType <TestSkillActor>();

            param.AddTargets(targetArrary);
            FilterTarget(context, data, param);
            var targets = param.Targets;

            //1.排除自己
            //2.排除已经弹射过的
            //3.找距离最近的
            //4.已经死亡的排除
            float       minDistance  = float.MaxValue;
            ISkillActor nearestActor = null;

            for (int i = 0; i < targets.Count; i++)
            {
                var target = targets[i];
                if (target.IsDead())
                {
                    continue;
                }
                //todo TestSkillActor remove
                if ((TestSkillActor)target == (TestSkillActor)context.GetSelfActor())
                {
                    continue;
                }
                if (!isIgnoreRepeat && param.BounceParam.HasBounced(target))
                {
                    continue;
                }

                var distance = Vector3.Distance(target.GetTransform().position,
                                                param.BounceParam.LastBouncedActor.GetTransform().position);
                if (distance < minDistance && distance <= range)
                {
                    minDistance  = distance;
                    nearestActor = target;
                }
            }

            param.ResetTarget();
            if (nearestActor != null)
            {
                param.AddTarget(nearestActor);
            }
        }
예제 #12
0
 protected BaseSkillContext(ISkillActor actor)
 {
     mSkillActor   = actor;
     mSkillManager = new SkillManager();
     mBuffManager  = new BuffManager();
 }
예제 #13
0
        private int time; //是否叠加

        public override void Create(ISkill skill, ISkillActor target, int buffId)
        {
            base.Create(skill, target, buffId);
            this.time = 1;
        }