private void ActionMoveLerp(ActorRoot actor, uint nDelta, bool bReset)
 {
     if ((actor != null) && !this.stopCondtion)
     {
         VInt3   location = actor.location;
         VInt3   num2     = this.destPosition - location;
         int     newMagn  = (int)((this.velocity * nDelta) / 0x3e8);
         Vector3 position = actor.gameObject.transform.position;
         if (this.gravity < 0)
         {
             VInt num4;
             num2.y      = 0;
             position   += (Vector3)num2.NormalizeTo(newMagn);
             position.y += ((float)this.gravityControler.GetMotionLerpDistance((int)nDelta)) / 1000f;
             if (PathfindingUtility.GetGroundY((VInt3)position, out num4) && (position.y < ((float)num4)))
             {
                 position.y = (float)num4;
             }
         }
         else
         {
             position += (Vector3)num2.NormalizeTo(newMagn);
         }
         actor.gameObject.transform.position = position;
     }
 }
示例#2
0
        private void ActionMoveLerp(ActorRoot actor, uint nDelta, bool bReset)
        {
            if (actor == null || this.stopCondtion)
            {
                return;
            }
            VInt3   location = actor.location;
            VInt3   vInt     = this.destPosition - location;
            int     num      = this.velocity * (int)nDelta / 1000;
            Vector3 vector   = actor.myTransform.position;

            if (this.gravity < 0)
            {
                vInt.y    = 0;
                vector   += (Vector3)vInt.NormalizeTo(num);
                vector.y += (float)this.gravityControler.GetMotionLerpDistance((int)nDelta) / 1000f;
                VInt vInt2;
                if (PathfindingUtility.GetGroundY((VInt3)vector, out vInt2) && vector.y < (float)vInt2)
                {
                    vector.y = (float)vInt2;
                }
            }
            else
            {
                vector += (Vector3)vInt.NormalizeTo(num);
            }
            actor.myTransform.position = vector;
        }
示例#3
0
 public void UseSkillCacheLerpMove(PoolObjHandle <ActorRoot> _actorRoot, int _deltaTime, int _moveSpeed)
 {
     if ((_actorRoot != 0) && (((this.cacheMoveCommand != null) && !this.cacheMoveExpire) && (this.cacheMoveCommand.cmdType == 2)))
     {
         FrameCommand <MoveDirectionCommand> cacheMoveCommand = (FrameCommand <MoveDirectionCommand>) this.cacheMoveCommand;
         if (!_actorRoot.handle.ActorControl.GetNoAbilityFlag(ObjAbilityType.ObjAbility_Move))
         {
             VInt3   num      = VInt3.right.RotateY(cacheMoveCommand.cmdData.Degree);
             Vector3 position = _actorRoot.handle.gameObject.transform.position;
             VInt3   delta    = num.NormalizeTo((_moveSpeed * _deltaTime) / 0x3e8);
             VInt    groundY  = 0;
             delta = PathfindingUtility.MoveLerp((ActorRoot)_actorRoot, (VInt3)position, delta, out groundY);
             if (_actorRoot.handle.MovementComponent.isFlying)
             {
                 float     y         = position.y;
                 Transform transform = _actorRoot.handle.gameObject.transform;
                 transform.position += (Vector3)delta;
                 Vector3 vector2 = _actorRoot.handle.gameObject.transform.position;
                 vector2.y = y;
                 _actorRoot.handle.gameObject.transform.position = vector2;
             }
             else
             {
                 Transform transform2 = _actorRoot.handle.gameObject.transform;
                 transform2.position += (Vector3)delta;
             }
         }
     }
 }
 public void UseSkillCacheLerpMove(PoolObjHandle <ActorRoot> _actorRoot, int _deltaTime, int _moveSpeed)
 {
     if (!_actorRoot)
     {
         return;
     }
     if (this.cacheMoveCommand != null && !this.cacheMoveExpire && this.cacheMoveCommand.cmdType == 131)
     {
         FrameCommand <MoveDirectionCommand> frameCommand = (FrameCommand <MoveDirectionCommand>) this.cacheMoveCommand;
         if (!_actorRoot.handle.ActorControl.GetNoAbilityFlag(ObjAbilityType.ObjAbility_Move))
         {
             VInt3   vInt     = VInt3.right.RotateY((int)frameCommand.cmdData.Degree);
             Vector3 position = _actorRoot.handle.myTransform.position;
             VInt3   vInt2    = vInt.NormalizeTo(_moveSpeed * _deltaTime / 1000);
             VInt    vInt3    = 0;
             vInt2 = PathfindingUtility.MoveLerp(_actorRoot, (VInt3)position, vInt2, out vInt3);
             if (_actorRoot.handle.MovementComponent.isFlying)
             {
                 float y = position.y;
                 _actorRoot.handle.myTransform.position += (Vector3)vInt2;
                 Vector3 position2 = _actorRoot.handle.myTransform.position;
                 position2.y = y;
                 _actorRoot.handle.myTransform.position = position2;
             }
             else
             {
                 _actorRoot.handle.myTransform.position += (Vector3)vInt2;
             }
         }
     }
 }
示例#5
0
 protected void CalcPosDir(out VInt3 outPos, out VInt3 outDir)
 {
     outPos = (VInt3)base.gameObject.transform.position;
     outDir = (VInt3)base.gameObject.transform.forward;
     if (this.RandomPos)
     {
         int num  = 0;
         int num2 = (int)FrameRandom.Random(2001u);
         if (num2 > 1000)
         {
             num2 -= 1000;
             num2  = -num2;
         }
         int num3 = (int)FrameRandom.Random(2001u);
         if (num3 > 1000)
         {
             num3 -= 1000;
             num3  = -num3;
         }
         VInt3   vInt = new VInt3(num2, num, num3);
         Vector3 a    = (Vector3)vInt;
         a.Normalize();
         int num4 = 0;
         if (this.RandomPosRadiusOuter - this.RandomPosRadiusInner > 0)
         {
             num4 = (int)FrameRandom.Random((uint)(this.RandomPosRadiusOuter - this.RandomPosRadiusInner)) + this.RandomPosRadiusInner;
         }
         float   d      = (float)num4 * 0.001f;
         Vector3 vector = (Vector3)outPos + a * d;
         outPos = (VInt3)vector;
         outDir = vInt.NormalizeTo(1000);
     }
 }
        public VFactor GetCosineAngle(VInt3 dest, MoveDirectionState state, out int edgeIndex)
        {
            VInt3 vInt  = this.v1 - this.v0;
            VInt3 vInt2 = this.v2 - this.v0;
            VInt3 vInt3 = dest - this.v0;

            vInt3.NormalizeTo(1000);
            vInt.NormalizeTo(1000);
            vInt2.NormalizeTo(1000);
            long    num    = VInt3.DotXZLong(ref vInt3, ref vInt);
            long    num2   = VInt3.DotXZLong(ref vInt3, ref vInt2);
            VFactor result = default(VFactor);

            result.den = 1000000L;
            if (num > num2)
            {
                edgeIndex  = this.vi;
                result.nom = num;
            }
            else
            {
                edgeIndex  = (this.vi + 2) % 3;
                result.nom = num2;
            }
            return(result);
        }
示例#7
0
        public VFactor GetCosineAngle(VInt3 dest, MoveDirectionState state, out int edgeIndex)
        {
            VInt3 rhs  = this.v1 - this.v0;
            VInt3 num2 = this.v2 - this.v0;
            VInt3 lhs  = dest - this.v0;

            lhs.NormalizeTo(0x3e8);
            rhs.NormalizeTo(0x3e8);
            num2.NormalizeTo(0x3e8);
            long    num4   = VInt3.DotXZLong(ref lhs, ref rhs);
            long    num5   = VInt3.DotXZLong(ref lhs, ref num2);
            VFactor factor = new VFactor {
                den = 0xf4240L
            };

            if (num4 > num5)
            {
                edgeIndex  = this.vi;
                factor.nom = num4;
                return(factor);
            }
            edgeIndex  = (this.vi + 2) % 3;
            factor.nom = num5;
            return(factor);
        }
示例#8
0
 protected void CalcPosDir(out VInt3 outPos, out VInt3 outDir)
 {
     outPos = (VInt3)base.gameObject.transform.position;
     outDir = (VInt3)base.gameObject.transform.forward;
     if (this.RandomPos)
     {
         int num  = 0;
         int num2 = FrameRandom.Random(0x7d1);
         if (num2 > 0x3e8)
         {
             num2 -= 0x3e8;
             num2  = -num2;
         }
         int num3 = FrameRandom.Random(0x7d1);
         if (num3 > 0x3e8)
         {
             num3 -= 0x3e8;
             num3  = -num3;
         }
         VInt3   num4   = new VInt3(num2, num, num3);
         Vector3 vector = (Vector3)num4;
         vector.Normalize();
         int num5 = 0;
         if ((this.RandomPosRadiusOuter - this.RandomPosRadiusInner) > 0)
         {
             num5 = FrameRandom.Random((uint)(this.RandomPosRadiusOuter - this.RandomPosRadiusInner)) + this.RandomPosRadiusInner;
         }
         float   num6    = num5 * 0.001f;
         Vector3 vector2 = ((Vector3)outPos) + ((Vector3)(vector * num6));
         outPos = (VInt3)vector2;
         outDir = num4.NormalizeTo(0x3e8);
     }
 }
示例#9
0
 public void Move(out VInt3 targetDir, int dt)
 {
     targetDir = VInt3.forward;
     if (!this.targetReached && this.canMove)
     {
         ActorRoot handle   = this.actor.handle;
         VInt3     location = handle.location;
         VInt3     num2     = this.CaculateDir(location);
         if ((this.targetDirection.x != 0) || (this.targetDirection.z != 0))
         {
             targetDir = this.targetDirection;
             targetDir.NormalizeTo(0x3e8);
         }
         else
         {
             targetDir = handle.forward;
         }
         VInt3 targetPos = handle.location;
         VInt3 delta     = num2;
         delta *= (this.speed * dt) / 0x3e8;
         delta  = (VInt3)(delta / 1000f);
         bool flag     = (this.rvo != null) && this.rvo.enabled;
         bool collided = false;
         if (this.checkNavNode && !flag)
         {
             VInt num5;
             delta          = PathfindingUtility.Move((ActorRoot)this.actor, delta, out num5, out collided);
             handle.groundY = num5;
         }
         VInt3 num7 = handle.location - this.targetPos;
         if (num7.sqrMagnitudeLong2D <= delta.sqrMagnitudeLong2D)
         {
             if (this.checkNavNode && !this.targetPosIsValid)
             {
                 targetPos = handle.location + delta;
             }
             else
             {
                 targetPos = this.targetPos;
             }
             this.targetReached = true;
             this.OnTargetReached();
         }
         else
         {
             targetPos = handle.location + delta;
         }
         if (flag)
         {
             VInt3 a = targetPos - handle.location;
             a = IntMath.Divide(a, 0x3e8L, (long)dt);
             this.rvo.Move(a);
         }
         else
         {
             handle.location          = targetPos;
             handle.hasReachedNavEdge = collided;
         }
     }
 }
示例#10
0
 protected void CalcPosDir(out VInt3 outPos, out VInt3 outDir)
 {
     outPos = (VInt3)base.gameObject.transform.position;
     outDir = (VInt3)base.gameObject.transform.forward;
     if (this.RandomPos)
     {
         int y   = 0;
         int num = (int)FrameRandom.Random(2001u);
         if (num > 1000)
         {
             num -= 1000;
             num  = -num;
         }
         int num2 = (int)FrameRandom.Random(2001u);
         if (num2 > 1000)
         {
             num2 -= 1000;
             num2  = -num2;
         }
         VInt3   ob = new VInt3(num, y, num2);
         Vector3 a  = (Vector3)ob;
         a.Normalize();
         int num3 = 0;
         if (this.RandomPosRadiusOuter - this.RandomPosRadiusInner > 0)
         {
             num3 = (int)FrameRandom.Random((uint)(this.RandomPosRadiusOuter - this.RandomPosRadiusInner)) + this.RandomPosRadiusInner;
         }
         float   d   = (float)num3 * 0.001f;
         Vector3 ob2 = (Vector3)outPos + a * d;
         outPos = (VInt3)ob2;
         outDir = ob.NormalizeTo(1000);
     }
 }
示例#11
0
        public void Update(ActorRoot _parent)
        {
            if (!this.childActorRoot)
            {
                return;
            }
            VInt3 vInt = _parent.location + this.translation;

            if (this.translation.x != 0 || this.translation.z != 0)
            {
                VInt3   forward = VInt3.forward;
                VFactor vFactor = VInt3.AngleInt(_parent.forward, forward);
                int     num     = _parent.forward.x * forward.z - forward.x * _parent.forward.z;
                if (num < 0)
                {
                    vFactor = VFactor.twoPi - vFactor;
                }
                VInt3 vInt2 = this.translation.RotateY(ref vFactor);
                vInt    = _parent.location + vInt2.NormalizeTo(this.distance.i);
                vInt.y += this.translation.y;
            }
            this.childActorRoot.get_handle().location = vInt;
            this.childActorRoot.get_handle().forward  = _parent.forward;
            this.UpdateMoveDelta(vInt);
        }
示例#12
0
        public override void Process(Action _action, Track _track, int _localTime)
        {
            base.Process(_action, _track, _localTime);
            if (!this.triggerActor || !this.targetActor || (this.moveSpeed == 0 && this.acceleration == 0))
            {
                return;
            }
            if (this.done_)
            {
                return;
            }
            VInt3 location = this.triggerActor.handle.location;
            VInt3 vInt     = this.targetActor.handle.location;
            int   num      = _localTime - this.lastTime_;

            this.lastTime_ = _localTime;
            VInt3 vInt2 = vInt - location;
            long  num2  = (long)this.curSpeed * (long)num + (long)this.acceleration * (long)num * (long)num / 2L / 1000L;

            this.curSpeed     = Mathf.Min(this.curSpeed + this.acceleration * num / 1000, this.maxMoveSpeed);
            this.curLerpSpeed = this.curSpeed;
            num2 /= 1000L;
            if (num2 >= (long)(vInt2.magnitude - this.lastDistance))
            {
                num2       = (long)Mathf.Max(vInt2.magnitude - this.lastDistance, 0);
                this.done_ = true;
                vInt       = location + vInt2.NormalizeTo((int)num2);
                if (!PathfindingUtility.IsValidTarget(this.triggerActor.handle, vInt))
                {
                    bool  flag  = false;
                    VInt3 vInt3 = PathfindingUtility.FindValidTarget(this.triggerActor.handle, vInt, this.triggerActor.handle.location, 10000, out flag);
                    VInt  vInt4 = 0;
                    PathfindingUtility.GetGroundY(vInt3, out vInt4);
                    vInt3.y = vInt4.i;
                    vInt    = vInt3;
                    vInt2   = vInt - this.triggerActor.handle.location;
                    num2    = (long)vInt2.magnitude;
                }
            }
            this.dir = vInt2;
            if (vInt2 != VInt3.zero)
            {
                this.triggerActor.handle.MovementComponent.SetRotate(this.dir, true);
                this.triggerActor.handle.rotation = Quaternion.LookRotation((Vector3)vInt2);
            }
            this.triggerActor.handle.location += vInt2.NormalizeTo((int)num2);
        }
        public void ProcessInner(Action _action, Track _track, int delta)
        {
            VInt3 location = this.moveActor.handle.location;

            if ((this.MoveType == ActorMoveType.Target) && (this.tarActor != 0))
            {
                this.destPosition = this.tarActor.handle.location;
                if ((this.tarActor != 0) && (this.tarActor.handle.CharInfo != null))
                {
                    CActorInfo charInfo = this.tarActor.handle.CharInfo;
                    this.hitHeight = charInfo.iBulletHeight;
                    VInt3 a = this.moveActor.handle.location - this.destPosition;
                    a.y = 0;
                    a   = a.NormalizeTo(0x3e8);
                    this.destPosition += IntMath.Divide(a, (long)charInfo.iCollisionSize.x, 0x3e8L);
                }
                this.destPosition.y += this.hitHeight;
            }
            this.moveDirection = this.destPosition - location;
            this.lerpDirection = this.moveDirection;
            if (this.bMoveRotate)
            {
                this.RotateMoveBullet(this.moveDirection);
            }
            int newMagn = (this.velocity * delta) / 0x3e8;

            if ((newMagn * newMagn) >= this.moveDirection.sqrMagnitudeLong2D)
            {
                this.moveActor.handle.location = this.destPosition;
                this.stopCondtion = true;
            }
            else
            {
                VInt3 num4;
                if (this.gravity < 0)
                {
                    VInt num5;
                    this.moveDirection.y = 0;
                    num4    = location + this.moveDirection.NormalizeTo(newMagn);
                    num4.y += this.gravityControler.GetMotionDeltaDistance(delta);
                    if (PathfindingUtility.GetGroundY(this.destPosition, out num5) && (num4.y < num5.i))
                    {
                        num4.y = num5.i;
                    }
                }
                else
                {
                    num4 = location + this.moveDirection.NormalizeTo(newMagn);
                }
                this.moveActor.handle.location = num4;
            }
            SkillUseContext refParamObject = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext");

            if (refParamObject != null)
            {
                refParamObject.EffectPos = this.moveActor.handle.location;
                refParamObject.EffectDir = this.moveDirection;
            }
        }
示例#14
0
 private void ActionMoveLerp(ActorRoot actor, uint nDelta, bool bReset)
 {
     if (actor != null)
     {
         if (this.done_ || this.teleport)
         {
             actor.gameObject.transform.position = (Vector3)actor.location;
         }
         else
         {
             VInt3 num3;
             VInt  groundY = 0;
             VInt3 dir     = this.dir;
             if (!this.shouldUseAcceleration)
             {
                 num3 = dir.NormalizeTo((int)((this.moveSpeed * nDelta) / 0x3e8));
             }
             else
             {
                 long num4 = (this.lastLerpMoveSpeed * nDelta) + ((long)((((this.acceleration * nDelta) * nDelta) / ((ulong)2L)) / ((ulong)0x3e8L)));
                 num4 /= 0x3e8L;
                 num3  = dir.NormalizeTo((int)num4);
                 this.lastLerpMoveSpeed += ((int)(this.acceleration * nDelta)) / 0x3e8;
             }
             Vector3 position = actor.gameObject.transform.position;
             if (!this.IgnoreCollision)
             {
                 num3 = PathfindingUtility.MoveLerp(actor, (VInt3)position, num3, out groundY);
             }
             if (actor.MovementComponent.isFlying)
             {
                 float     y         = position.y;
                 Transform transform = actor.gameObject.transform;
                 transform.position += (Vector3)num3;
                 Vector3 vector2 = actor.gameObject.transform.position;
                 vector2.y = y;
                 actor.gameObject.transform.position = vector2;
             }
             else
             {
                 Transform transform2 = actor.gameObject.transform;
                 transform2.position += (Vector3)num3;
             }
         }
     }
 }
示例#15
0
 private void ActionMoveLerp(ActorRoot actor, uint nDelta, bool bReset)
 {
     if (actor == null)
     {
         return;
     }
     if (this.done_ || this.teleport)
     {
         actor.myTransform.position = (Vector3)actor.location;
     }
     else
     {
         VInt  vInt  = 0;
         VInt3 vInt2 = this.dir;
         VInt3 vInt3;
         if (!this.shouldUseAcceleration)
         {
             vInt3 = vInt2.NormalizeTo(this.moveSpeed * (int)nDelta / 1000);
         }
         else
         {
             long num = (long)this.lastLerpMoveSpeed * (long)((ulong)nDelta) + (long)this.acceleration * (long)((ulong)nDelta) * (long)((ulong)nDelta) / 2L / 1000L;
             num  /= 1000L;
             vInt3 = vInt2.NormalizeTo((int)num);
             this.lastLerpMoveSpeed += (int)((long)this.acceleration * (long)((ulong)nDelta)) / 1000;
         }
         Vector3 position = actor.myTransform.position;
         if (!this.IgnoreCollision)
         {
             vInt3 = PathfindingUtility.MoveLerp(actor, (VInt3)position, vInt3, out vInt);
         }
         if (actor.MovementComponent.isFlying)
         {
             float y = position.y;
             actor.myTransform.position += (Vector3)vInt3;
             Vector3 position2 = actor.myTransform.position;
             position2.y = y;
             actor.myTransform.position = position2;
         }
         else
         {
             actor.myTransform.position += (Vector3)vInt3;
         }
     }
 }
 private void RotateMoveBullet(VInt3 _dir)
 {
     if (_dir != VInt3.zero)
     {
         this.moveActor.handle.forward = _dir.NormalizeTo(0x3e8);
         Quaternion identity = Quaternion.identity;
         identity = Quaternion.LookRotation((Vector3)_dir);
         this.moveActor.handle.rotation = identity;
     }
 }
 private void RotateMoveBullet(VInt3 _dir)
 {
     if (((this.MoveType == ActorMoveType.Target) || (this.MoveType == ActorMoveType.Directional)) && (_dir != VInt3.zero))
     {
         this.moveActor.handle.forward = _dir.NormalizeTo(0x3e8);
         Quaternion identity = Quaternion.identity;
         identity = Quaternion.LookRotation((Vector3)_dir);
         this.moveActor.handle.rotation = identity;
     }
 }
示例#18
0
        private void RotateMoveBullet(VInt3 _dir)
        {
            if (_dir == VInt3.zero)
            {
                return;
            }
            this.moveActor.get_handle().forward = _dir.NormalizeTo(1000);
            Quaternion rotation = Quaternion.identity;

            rotation = Quaternion.LookRotation((Vector3)_dir);
            this.moveActor.get_handle().rotation = rotation;
        }
示例#19
0
    public static VInt3 MoveTowards(VInt3 from, VInt3 to, int dt)
    {
        VInt3 num2 = to - from;

        if (num2.sqrMagnitudeLong <= (dt * dt))
        {
            return(to);
        }
        VInt3 num = to - from;

        return(from + num.NormalizeTo(dt));
    }
示例#20
0
 public override void SetRotate(VInt3 InDirection, bool bInRotateImmediately)
 {
     if ((InDirection != VInt3.zero) && !base.actor.ActorControl.GetNoAbilityFlag(ObjAbilityType.ObjAbility_MoveRotate))
     {
         InDirection        = InDirection.NormalizeTo(0x3e8);
         base.actor.forward = InDirection;
         base.actor.ObjLinker.SetForward(InDirection, -1);
         base.actor.rotation     = Quaternion.LookRotation((Vector3)InDirection);
         this.bRotateImmediately = bInRotateImmediately;
         this.bRotatingLock      = true;
     }
 }
    protected VInt3 CaculateDir(VInt3 currentPosition)
    {
        if (this.path == null || this.path.vectorPath == null || this.path.vectorPath.get_Count() == 0)
        {
            return(VInt3.zero);
        }
        List <VInt3> vectorPath = this.path.vectorPath;

        if (vectorPath.get_Count() == 1)
        {
            vectorPath.Insert(0, currentPosition);
        }
        if (this.currentWaypointIndex >= vectorPath.get_Count())
        {
            this.currentWaypointIndex = vectorPath.get_Count() - 1;
        }
        if (this.currentWaypointIndex <= 1)
        {
            this.currentWaypointIndex = 1;
        }
        while (this.currentWaypointIndex < vectorPath.get_Count() - 1)
        {
            long num = vectorPath.get_Item(this.currentWaypointIndex).XZSqrMagnitude(currentPosition);
            if (num == 0L)
            {
                this.lastFoundWaypointPosition = currentPosition;
                this.lastFoundWaypointTime     = Time.time;
                this.currentWaypointIndex++;
            }
            else
            {
                if (num >= (long)(this.pickNextWaypointDist * this.pickNextWaypointDist))
                {
                    break;
                }
                VInt3 rhs  = vectorPath.get_Item(this.currentWaypointIndex - 1);
                VInt3 lhs  = vectorPath.get_Item(this.currentWaypointIndex);
                VInt3 vInt = lhs - rhs;
                long  num2 = (long)vInt.magnitude2D;
                if (VInt3.DotXZLong(currentPosition - rhs, vInt.NormalizeTo(1000)) < num2 * 1000L)
                {
                    break;
                }
                this.lastFoundWaypointPosition = currentPosition;
                this.lastFoundWaypointTime     = Time.time;
                this.currentWaypointIndex++;
            }
        }
        this.targetPoint       = this.CalculateTargetPoint(currentPosition, vectorPath.get_Item(this.currentWaypointIndex - 1), vectorPath.get_Item(this.currentWaypointIndex));
        this.targetDirection   = this.targetPoint - currentPosition;
        this.targetDirection.y = 0;
        return(this.targetDirection.NormalizeTo(1000));
    }
        public override VInt3 SelectTargetDir(SkillSlot UseSlot)
        {
            ActorRoot target = SelectTargetHelper.GetTarget(UseSlot);

            if (target != null)
            {
                VInt3 num = target.location - UseSlot.Actor.handle.location;
                num.y = 0;
                return(num.NormalizeTo(0x3e8));
            }
            return(UseSlot.Actor.handle.forward);
        }
        public override VInt3 SelectTargetDir(SkillSlot UseSlot)
        {
            ActorRoot nextSkillTarget = this.GetNextSkillTarget(UseSlot);

            if (nextSkillTarget != null)
            {
                VInt3 vInt = nextSkillTarget.location - UseSlot.Actor.get_handle().location;
                vInt.y = 0;
                return(vInt.NormalizeTo(1000));
            }
            return(UseSlot.Actor.get_handle().forward);
        }
 public override void UpdateShape(VInt3 location, VInt3 forward, int moveDelta)
 {
     this.axis[2]        = forward;
     this.axis[0]        = VInt3.Cross(ref this.axis[1], ref this.axis[2]);
     location           -= forward.NormalizeTo(moveDelta >> 1);
     this.worldPos       = IntMath.Transform(ref this.localPos, ref this.axis[0], ref this.axis[1], ref this.axis[2], ref location);
     this.worldExtends.x = this.size.x >> 1;
     this.worldExtends.y = this.size.y >> 1;
     this.worldExtends.z = this.size.z + moveDelta >> 1;
     this.worldRadius    = Mathf.Max(this.worldExtends.x, Mathf.Max(this.worldExtends.y, this.worldExtends.z));
     this.dirty          = false;
 }
        public override VInt3 SelectTargetDir(SkillSlot UseSlot)
        {
            ActorRoot lowestHpTarget = Singleton <TargetSearcher> .GetInstance().GetLowestHpTarget(UseSlot.Actor.get_handle(), UseSlot.SkillObj.GetMaxSearchDistance(UseSlot.GetSkillLevel()), TargetPriority.TargetPriority_Hero, UseSlot.SkillObj.cfgData.dwSkillTargetFilter, false, true);

            if (lowestHpTarget != null)
            {
                VInt3 vInt = lowestHpTarget.location - UseSlot.Actor.get_handle().location;
                vInt.y = 0;
                return(vInt.NormalizeTo(1000));
            }
            return(UseSlot.Actor.get_handle().forward);
        }
        public override VInt3 SelectTargetDir(SkillSlot UseSlot)
        {
            ActorRoot root = Singleton <TargetSearcher> .GetInstance().GetLowestHpTarget(UseSlot.Actor.handle, UseSlot.SkillObj.cfgData.iMaxSearchDistance, TargetPriority.TargetPriority_Hero, UseSlot.SkillObj.cfgData.dwSkillTargetFilter, false, true);

            if (root != null)
            {
                VInt3 num = root.location - UseSlot.Actor.handle.location;
                num.y = 0;
                return(num.NormalizeTo(0x3e8));
            }
            return(UseSlot.Actor.handle.forward);
        }
示例#27
0
    protected VInt3 CaculateDir(VInt3 currentPosition)
    {
        if (this.path == null || this.path.vectorPath == null || this.path.vectorPath.get_Count() == 0)
        {
            return(VInt3.zero);
        }
        List <VInt3> vectorPath = this.path.vectorPath;

        if (vectorPath.get_Count() == 1)
        {
            vectorPath.Insert(0, currentPosition);
        }
        if (this.currentWaypointIndex >= vectorPath.get_Count())
        {
            this.currentWaypointIndex = vectorPath.get_Count() - 1;
        }
        if (this.currentWaypointIndex <= 1)
        {
            this.currentWaypointIndex = 1;
        }
        while (this.currentWaypointIndex < vectorPath.get_Count() - 1)
        {
            long num = vectorPath.get_Item(this.currentWaypointIndex).XZSqrMagnitude(currentPosition);
            if (num != 0L)
            {
                if (num < (long)this.pickNextWaypointDist * (long)this.pickNextWaypointDist)
                {
                    VInt3 vInt  = vectorPath.get_Item(this.currentWaypointIndex - 1);
                    VInt3 vInt2 = vectorPath.get_Item(this.currentWaypointIndex);
                    VInt3 vInt3 = vInt2 - vInt;
                    long  num2  = (long)vInt3.get_magnitude2D();
                    long  num3  = VInt3.DotXZLong(currentPosition - vInt, vInt3.NormalizeTo(1000));
                    if (num3 >= num2 * 1000L)
                    {
                        this.lastFoundWaypointPosition = currentPosition;
                        this.lastFoundWaypointTime     = Time.time;
                        this.currentWaypointIndex++;
                        continue;
                    }
                }
IL_184:
                this.targetPoint       = this.CalculateTargetPoint(currentPosition, vectorPath.get_Item(this.currentWaypointIndex - 1), vectorPath.get_Item(this.currentWaypointIndex));
                this.targetDirection   = this.targetPoint - currentPosition;
                this.targetDirection.y = 0;
                return(this.targetDirection.NormalizeTo(1000));
            }
            this.lastFoundWaypointPosition = currentPosition;
            this.lastFoundWaypointTime     = Time.time;
            this.currentWaypointIndex++;
        }
        goto IL_184;
    }
示例#28
0
    protected VInt3 CaculateDir(VInt3 currentPosition)
    {
        if (((this.path == null) || (this.path.vectorPath == null)) || (this.path.vectorPath.Count == 0))
        {
            return(VInt3.zero);
        }
        List <VInt3> vectorPath = this.path.vectorPath;

        if (vectorPath.Count == 1)
        {
            vectorPath.Insert(0, currentPosition);
        }
        if (this.currentWaypointIndex >= vectorPath.Count)
        {
            this.currentWaypointIndex = vectorPath.Count - 1;
        }
        if (this.currentWaypointIndex <= 1)
        {
            this.currentWaypointIndex = 1;
        }
Label_0088:
        if (this.currentWaypointIndex < (vectorPath.Count - 1))
        {
            long num = vectorPath[this.currentWaypointIndex].XZSqrMagnitude(currentPosition);
            if (num == 0)
            {
                this.lastFoundWaypointPosition = currentPosition;
                this.lastFoundWaypointTime     = Time.time;
                this.currentWaypointIndex++;
                goto Label_0088;
            }
            if (num < (this.pickNextWaypointDist * this.pickNextWaypointDist))
            {
                VInt3 num2 = vectorPath[this.currentWaypointIndex - 1];
                VInt3 num3 = vectorPath[this.currentWaypointIndex];
                VInt3 num4 = num3 - num2;
                long  num5 = num4.magnitude2D;
                if (VInt3.DotXZLong(currentPosition - num2, num4.NormalizeTo(0x3e8)) >= (num5 * 0x3e8L))
                {
                    this.lastFoundWaypointPosition = currentPosition;
                    this.lastFoundWaypointTime     = Time.time;
                    this.currentWaypointIndex++;
                    goto Label_0088;
                }
            }
        }
        this.targetPoint       = this.CalculateTargetPoint(currentPosition, vectorPath[this.currentWaypointIndex - 1], vectorPath[this.currentWaypointIndex]);
        this.targetDirection   = this.targetPoint - currentPosition;
        this.targetDirection.y = 0;
        return(this.targetDirection.NormalizeTo(0x3e8));
    }
    public static VInt3 FindValidTarget(ActorRoot actor, VInt3 start, VInt3 end, int radius, out bool bResult)
    {
        long num  = (long)radius * (long)radius;
        long num2 = start.XZSqrMagnitude(ref end);

        if (num2 < num)
        {
            return(PathfindingUtility.FindValidTarget(actor, start, end, out bResult));
        }
        VInt3 vInt = end - start;
        VInt3 end2 = start + vInt.NormalizeTo(radius);

        return(PathfindingUtility.FindValidTarget(actor, start, end2, out bResult));
    }
 private void RotateMoveActor(VInt3 _dir)
 {
     if (this.MoveToRealTimePosition)
     {
         if (_dir == VInt3.zero)
         {
             return;
         }
         this.actor_.handle.forward = _dir.NormalizeTo(1000);
         Quaternion rotation = Quaternion.identity;
         rotation = Quaternion.LookRotation((Vector3)_dir);
         this.actor_.handle.rotation = rotation;
     }
 }