Example #1
0
        public List <GameObject> GetNeighbours(bool colliding)
        {
            if (!base.enabled || this.rvoAgent == null)
            {
                return(null);
            }
            Agent rvoAgent = this.rvoAgent;

            if (rvoAgent.neighbours.get_Count() == 0)
            {
                return(null);
            }
            List <GameObject> list = new List <GameObject>();

            for (int i = 0; i < rvoAgent.neighbours.get_Count(); i++)
            {
                Agent agent = rvoAgent.neighbours.get_Item(i);
                if (agent != rvoAgent && agent.owner != null)
                {
                    if (colliding)
                    {
                        int num  = Math.Min(rvoAgent.position.y + rvoAgent.height.i, agent.position.y + agent.height.i);
                        int num2 = Math.Max(rvoAgent.position.y, agent.position.y);
                        if (num - num2 >= 0)
                        {
                            VInt3 vInt = agent.position - rvoAgent.position;
                            vInt.y = 0;
                            long num3 = (long)(rvoAgent.radius.i + agent.radius.i);
                            num3 *= num3;
                            if (vInt.get_sqrMagnitudeLong() < num3)
                            {
                                list.Add(agent.owner as GameObject);
                            }
                        }
                    }
                    else
                    {
                        list.Add(agent.owner as GameObject);
                    }
                }
            }
            return(list);
        }
Example #2
0
        private bool UseImpl(PoolObjHandle <ActorRoot> user)
        {
            if (this.skillContext == null || !this.skillContext.TargetActor || this.cfgData == null)
            {
                return(false);
            }
            BuffHolderComponent buffHolderComp = this.skillContext.TargetActor.get_handle().BuffHolderComp;

            if (buffHolderComp == null)
            {
                return(false);
            }
            if (!this.CheckUseRule(this.skillContext))
            {
                return(false);
            }
            if (!buffHolderComp.overlayRule.CheckOverlay(this))
            {
                return(false);
            }
            bool  flag  = false;
            bool  flag2 = false;
            VInt3 value = VInt3.forward;

            switch (this.skillContext.AppointType)
            {
            case 2:
                flag = true;
                break;

            case 3:
                flag2 = true;
                value = this.skillContext.UseVector;
                if (this.skillContext.TargetID != 0u)
                {
                    PoolObjHandle <ActorRoot> actor = Singleton <GameObjMgr> .GetInstance().GetActor(this.skillContext.TargetID);

                    if (actor)
                    {
                        Vector3 vector = actor.get_handle().myTransform.position - user.get_handle().myTransform.position;
                        vector.y = 0f;
                        vector.Normalize();
                        value = (VInt3)vector;
                    }
                }
                break;

            case 4:
                flag  = true;
                flag2 = true;
                value = this.skillContext.EndVector - this.skillContext.UseVector;
                if (value.get_sqrMagnitudeLong() < 1L)
                {
                    value = VInt3.forward;
                }
                break;
            }
            GameObject gameObject  = (!this.skillContext.Originator) ? null : this.skillContext.Originator.get_handle().gameObject;
            GameObject gameObject2 = (!this.skillContext.TargetActor) ? null : this.skillContext.TargetActor.get_handle().gameObject;

            this.curAction = new PoolObjHandle <Action>(ActionManager.Instance.PlayAction(this.ActionName, true, false, new GameObject[]
            {
                gameObject,
                gameObject2
            }));
            if (!this.curAction)
            {
                return(false);
            }
            this.curAction.get_handle().onActionStop += new ActionStopDelegate(this.OnActionStoped);
            this.curAction.get_handle().refParams.AddRefParam("SkillObj", this);
            this.curAction.get_handle().refParams.AddRefParam("SkillContext", this.skillContext);
            this.curAction.get_handle().refParams.AddRefParam("TargetActor", this.skillContext.TargetActor);
            this.curAction.get_handle().refParams.SetRefParam("_BulletPos", this.skillContext.EffectPos);
            this.curAction.get_handle().refParams.SetRefParam("_BulletDir", this.skillContext.EffectDir);
            if (flag)
            {
                this.curAction.get_handle().refParams.SetRefParam("_TargetPos", this.skillContext.UseVector);
            }
            if (flag2)
            {
                this.curAction.get_handle().refParams.SetRefParam("_TargetDir", value);
            }
            if (this.cfgData != null)
            {
                SkillSlotType slotType = this.skillContext.SlotType;
                int           num      = this.cfgData.iDuration;
                if (slotType >= SkillSlotType.SLOT_SKILL_1 && slotType <= SkillSlotType.SLOT_SKILL_3)
                {
                    int num2 = 1;
                    if (this.skillContext.Originator && this.skillContext.Originator.get_handle().SkillControl != null)
                    {
                        SkillSlot skillSlot = null;
                        this.skillContext.Originator.get_handle().SkillControl.TryGetSkillSlot(slotType, out skillSlot);
                        if (skillSlot != null)
                        {
                            num2 = skillSlot.GetSkillLevel();
                        }
                    }
                    num2 = ((num2 >= 1) ? num2 : 1);
                    num += (num2 - 1) * this.cfgData.iDurationGrow;
                }
                if (this.skillContext.Originator && this.skillContext.Originator.get_handle() != null && this.skillContext.Originator.get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && this.skillContext.Originator.get_handle().TheStaticData.TheHeroOnlyInfo.AttackDistanceType == 2 && this.cfgData.iLongRangeReduction > 0)
                {
                    num = num * this.cfgData.iLongRangeReduction / 10000;
                }
                this.curAction.get_handle().ResetLength(num, false);
                if (this.cfgData.bEffectType == 2)
                {
                    this.DealTenacity(this.skillContext.TargetActor);
                }
            }
            bool flag3 = true;

            if (this.cfgData.bShowType != 0 || this.cfgData.bFloatTextID > 0)
            {
                if (!this.skillContext.TargetActor || this.skillContext.TargetActor.get_handle() == null || this.skillContext.TargetActor.get_handle().BuffHolderComp == null || this.skillContext.TargetActor.get_handle().BuffHolderComp.SpawnedBuffList == null)
                {
                    return(false);
                }
                for (int i = 0; i < this.skillContext.TargetActor.get_handle().BuffHolderComp.SpawnedBuffList.get_Count(); i++)
                {
                    BuffSkill buffSkill = this.skillContext.TargetActor.get_handle().BuffHolderComp.SpawnedBuffList.get_Item(i);
                    if (buffSkill != null && buffSkill.cfgData != null && buffSkill.cfgData.iCfgID == this.cfgData.iCfgID)
                    {
                        flag3 = false;
                        break;
                    }
                }
                if (flag3)
                {
                    SpawnBuffEventParam spawnBuffEventParam = new SpawnBuffEventParam((uint)this.cfgData.bShowType, (uint)this.cfgData.bFloatTextID, this.skillContext.TargetActor);
                    Singleton <GameSkillEventSys> .GetInstance().SendEvent <SpawnBuffEventParam>(GameSkillEventDef.Event_SpawnBuff, this.skillContext.TargetActor, ref spawnBuffEventParam, GameSkillEventChannel.Channel_HostCtrlActor);
                }
            }
            this.skillContext.TargetActor.get_handle().BuffHolderComp.AddBuff(this);
            if (this.cfgData.bEffectType == 2 && this.cfgData.bShowType != 2)
            {
                LimitMoveEventParam limitMoveEventParam = new LimitMoveEventParam(base.CurAction.get_handle().length, this.SkillID, this.skillContext.TargetActor);
                Singleton <GameSkillEventSys> .GetInstance().SendEvent <LimitMoveEventParam>(GameSkillEventDef.AllEvent_LimitMove, this.skillContext.TargetActor, ref limitMoveEventParam, GameSkillEventChannel.Channel_AllActor);
            }
            if (this.bAgeImmeExcute)
            {
                this.curAction.get_handle().UpdateLogic((int)Singleton <FrameSynchr> .GetInstance().FrameDelta);
            }
            return(true);
        }
Example #3
0
        private bool UseImpl(PoolObjHandle <ActorRoot> user)
        {
            bool  flag  = false;
            bool  flag2 = false;
            bool  flag3 = false;
            VInt3 value = VInt3.forward;

            switch (this.skillContext.AppointType)
            {
            case 0:
            case 1:
                flag = true;
                break;

            case 2:
                flag2 = true;
                break;

            case 3:
                flag3 = true;
                value = this.skillContext.UseVector;
                if (this.skillContext.TargetID != 0u)
                {
                    PoolObjHandle <ActorRoot> actor = Singleton <GameObjMgr> .GetInstance().GetActor(this.skillContext.TargetID);

                    if (actor)
                    {
                        Vector3 vector = actor.get_handle().myTransform.position - user.get_handle().myTransform.position;
                        vector.y = 0f;
                        vector.Normalize();
                        value = (VInt3)vector;
                    }
                }
                break;

            case 4:
                flag2 = true;
                flag3 = true;
                value = this.skillContext.EndVector - this.skillContext.UseVector;
                if (value.get_sqrMagnitudeLong() < 1L)
                {
                    value = VInt3.forward;
                }
                break;
            }
            if (flag && !this.skillContext.TargetActor)
            {
                return(false);
            }
            if (flag)
            {
                this.curAction = new PoolObjHandle <Action>(ActionManager.Instance.PlayAction(this.ActionName, true, false, new GameObject[]
                {
                    user.get_handle().gameObject,
                    this.skillContext.TargetActor.get_handle().gameObject
                }));
            }
            else
            {
                this.curAction = new PoolObjHandle <Action>(ActionManager.Instance.PlayAction(this.ActionName, true, false, new GameObject[]
                {
                    user.get_handle().gameObject
                }));
            }
            if (!this.curAction)
            {
                return(false);
            }
            this.curAction.get_handle().onActionStop += this.OnActionStopDelegate;
            this.curAction.get_handle().refParams.AddRefParam("SkillObj", this);
            this.curAction.get_handle().refParams.AddRefParam("SkillContext", this.skillContext);
            if (flag)
            {
                this.curAction.get_handle().refParams.AddRefParam("TargetActor", this.skillContext.TargetActor);
            }
            if (flag2)
            {
                this.curAction.get_handle().refParams.SetRefParam("_TargetPos", this.skillContext.UseVector);
            }
            if (flag3)
            {
                this.curAction.get_handle().refParams.SetRefParam("_TargetDir", value);
            }
            this.curAction.get_handle().refParams.SetRefParam("_BulletPos", this.skillContext.BulletPos);
            this.curAction.get_handle().refParams.SetRefParam("_BulletUseDir", user.get_handle().forward);
            if (this.bAgeImmeExcute)
            {
                this.curAction.get_handle().UpdateLogic((int)Singleton <FrameSynchr> .GetInstance().FrameDelta);
            }
            return(true);
        }