public static VInt3 Move(ActorRoot actor, VInt3 delta, out VInt groundY, out bool collided, MoveDirectionState state = null)
    {
        VInt3 result = PathfindingUtility.Move(actor, delta, out groundY, state);

        collided = (result.x != delta.x || result.z != delta.z);
        return(result);
    }
示例#2
0
 public void UseSkillCacheMove(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 delta   = VInt3.right.RotateY(cacheMoveCommand.cmdData.Degree).NormalizeTo((_moveSpeed * _deltaTime) / 0x3e8);
             VInt  groundY = _actorRoot.handle.groundY;
             delta = PathfindingUtility.Move(_actorRoot.handle, delta, out groundY, out _actorRoot.handle.hasReachedNavEdge, null);
             if (_actorRoot.handle.MovementComponent.isFlying)
             {
                 int       y      = _actorRoot.handle.location.y;
                 ActorRoot handle = _actorRoot.handle;
                 handle.location += delta;
                 VInt3 location = _actorRoot.handle.location;
                 location.y = y;
                 _actorRoot.handle.location = location;
             }
             else
             {
                 ActorRoot local2 = _actorRoot.handle;
                 local2.location += delta;
             }
             _actorRoot.handle.groundY = groundY;
         }
     }
 }
示例#3
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;
         }
     }
 }
示例#4
0
        public void Teleport()
        {
            VInt  groundY = this.actor_.get_handle().groundY;
            VInt3 vInt    = this.dir.NormalizeTo(this.moveDistance);
            VInt3 vInt2   = this.actor_.get_handle().location + vInt;
            bool  flag    = false;

            if (PathfindingUtility.IsValidTarget(this.actor_, vInt2))
            {
                PathfindingUtility.GetGroundY(vInt2, out groundY);
                vInt2.y = groundY.i;
                this.actor_.get_handle().location = vInt2;
            }
            else
            {
                VInt3 vInt3 = PathfindingUtility.FindValidTarget(this.actor_, vInt2, this.actor_.get_handle().location, 10000, out flag);
                if (flag)
                {
                    PathfindingUtility.GetGroundY(vInt3, out groundY);
                    vInt3.y = groundY.i;
                    this.actor_.get_handle().location = vInt3;
                }
                else
                {
                    vInt = PathfindingUtility.Move(this.actor_.get_handle(), vInt, out groundY, out this.actor_.get_handle().hasReachedNavEdge, null);
                    this.actor_.get_handle().location += vInt;
                }
            }
            if (this.bUseRecordPosition)
            {
                this.actor_.get_handle().ActorControl.RmvNoAbilityFlag(ObjAbilityType.ObjAbility_MoveProtect);
            }
            this.actor_.get_handle().groundY = groundY;
            this.done_ = true;
        }
    public static Int3 Move(Actor actor, Int3 delta, out Int1 groundY, out bool collided)
    {
        Int3 result = PathfindingUtility.Move(actor, delta, out groundY);

        collided = (result.x != delta.x || result.z != delta.z);
        return(result);
    }
 public void UseSkillCacheMove(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).NormalizeTo(_moveSpeed * _deltaTime / 1000);
             VInt  groundY = _actorRoot.handle.groundY;
             vInt = PathfindingUtility.Move(_actorRoot.handle, vInt, out groundY, out _actorRoot.handle.hasReachedNavEdge, null);
             if (_actorRoot.handle.MovementComponent.isFlying)
             {
                 int y = _actorRoot.handle.location.y;
                 _actorRoot.handle.location += vInt;
                 VInt3 location = _actorRoot.handle.location;
                 location.y = y;
                 _actorRoot.handle.location = location;
             }
             else
             {
                 _actorRoot.handle.location += vInt;
             }
             _actorRoot.handle.groundY = groundY;
         }
     }
 }
        public override void Move(VInt3 delta)
        {
            ActorRoot actor = this.Movement.actor;
            VInt      groundY;

            actor.location += PathfindingUtility.Move(actor, delta, out groundY, out actor.hasReachedNavEdge, this.Movement.MoveDirState);
            actor.groundY   = groundY;
        }
示例#8
0
        public override void Move(VInt3 delta)
        {
            VInt      num;
            ActorRoot actor = base.Movement.actor;

            actor.location += PathfindingUtility.Move(actor, delta, out num, out actor.hasReachedNavEdge, base.Movement.MoveDirState);
            actor.groundY   = num;
        }
示例#9
0
 public override void Process(Action _action, Track _track, int _localTime)
 {
     if (!this.done_ && (this.actor_ != 0))
     {
         bool flag     = this.lastTime_ < this.rotationTime;
         int  moveTick = _localTime - this.lastTime_;
         this.lastTime_ = _localTime;
         if (this.teleport)
         {
             this.Teleport();
         }
         else
         {
             if (flag)
             {
                 float      t          = Mathf.Min(1f, (float)(_localTime / this.rotationTime));
                 Quaternion quaternion = Quaternion.Slerp(this.fromRot, this.toRot, t);
                 this.actor_.handle.rotation = quaternion;
             }
             if ((this.moveTick - moveTick) <= 0)
             {
                 moveTick   = this.moveTick;
                 this.done_ = true;
             }
             else
             {
                 this.moveTick -= moveTick;
             }
             VInt3 delta   = this.dir.NormalizeTo((this.moveSpeed * moveTick) / 0x3e8);
             VInt  groundY = this.actor_.handle.groundY;
             if (!this.IgnoreCollision)
             {
                 delta = PathfindingUtility.Move(this.actor_.handle, delta, out groundY, out this.actor_.handle.hasReachedNavEdge);
             }
             if (this.actor_.handle.MovementComponent.isFlying)
             {
                 int       y      = this.actor_.handle.location.y;
                 ActorRoot handle = this.actor_.handle;
                 handle.location += delta;
                 VInt3 location = this.actor_.handle.location;
                 location.y = y;
                 this.actor_.handle.location = location;
             }
             else
             {
                 ActorRoot local2 = this.actor_.handle;
                 local2.location += delta;
             }
             this.actor_.handle.groundY = groundY;
             base.Process(_action, _track, _localTime);
         }
     }
 }
        public void DoUpdate(float dt)
        {
            if (this.rvoAgent == null)
            {
                return;
            }
            ActorRoot handle = this.actor.handle;

            if (this.lastPosition != handle.location)
            {
                this.Teleport(handle.location);
            }
            if (this.lockWhenNotMoving)
            {
                this.locked = (this.desiredVelocity == VInt3.zero);
            }
            this.UpdateAgentProperties();
            VInt3 interpolatedPosition = this.rvoAgent.InterpolatedPosition;

            this.rvoAgent.SetYPosition(this.adjustedY);
            this.rvoAgent.DesiredVelocity = this.desiredVelocity;
            VInt3 vInt = interpolatedPosition - this.center;

            vInt.y += this.height.i >> 1;
            if (this.checkNavNode)
            {
                VInt3 delta = vInt - handle.location;
                VInt  groundY;
                VInt3 rhs   = PathfindingUtility.Move(this.actor, delta, out groundY, out handle.hasReachedNavEdge, null);
                VInt3 vInt2 = handle.location + rhs;
                handle.location = vInt2;
                handle.groundY  = groundY;
                this.rvoAgent.Teleport(vInt2);
                this.adjustedY = vInt2.y;
            }
            else
            {
                handle.location = vInt;
            }
            this.lastPosition = handle.location;
            if (this.enableRotation && this.velocity != VInt3.zero)
            {
                Vector3   forward   = (Vector3)this.velocity;
                Transform transform = base.transform;
                transform.rotation = Quaternion.Lerp(transform.rotation, Quaternion.LookRotation(forward), dt * this.rotationSpeed * Mathf.Min((float)this.velocity.magnitude, 0.2f));
            }
        }
示例#11
0
        public override void Process(Action _action, Track _track, int _localTime)
        {
            if (!this.actor_)
            {
                return;
            }
            bool flag      = this.lastTime_ < this.rotationTime;
            int  deltaTime = _localTime - this.lastTime_;

            this.lastTime_ = _localTime;
            if (flag && this.enableRotate)
            {
                float      t        = Mathf.Min(1f, (float)(_localTime / this.rotationTime));
                Quaternion rotation = Quaternion.Slerp(this.fromRot, this.toRot, t);
                this.actor_.get_handle().rotation = rotation;
            }
            if (this.done_)
            {
                return;
            }
            int   motionDeltaDistance = this.motionControler.GetMotionDeltaDistance(deltaTime);
            VInt3 delta = this.moveDirection * motionDeltaDistance / 1000f;
            VInt  groundY;
            VInt3 vInt = PathfindingUtility.Move(this.actor_.get_handle(), delta, out groundY, null);

            if (this.actor_.get_handle().MovementComponent.isFlying)
            {
                int y = this.actor_.get_handle().location.y;
                this.actor_.get_handle().location += vInt;
                VInt3 location = this.actor_.get_handle().location;
                location.y = y;
                this.actor_.get_handle().location = location;
            }
            else
            {
                this.actor_.get_handle().location += vInt;
            }
            this.actor_.get_handle().groundY = groundY;
            if (delta.x != vInt.x || delta.z != vInt.z)
            {
                this.done_       = true;
                this.bHitNavEdge = true;
            }
            base.Process(_action, _track, _localTime);
        }
示例#12
0
 public void DoUpdate(float dt)
 {
     if (this.rvoAgent != null)
     {
         ActorRoot handle = this.actor.handle;
         if (this.lastPosition != handle.location)
         {
             this.Teleport(handle.location);
         }
         if (this.lockWhenNotMoving)
         {
             this.locked = this.desiredVelocity == VInt3.zero;
         }
         this.UpdateAgentProperties();
         VInt3 interpolatedPosition = this.rvoAgent.InterpolatedPosition;
         this.rvoAgent.SetYPosition(this.adjustedY);
         this.rvoAgent.DesiredVelocity = this.desiredVelocity;
         VInt3 num2 = interpolatedPosition - this.center;
         num2.y += this.height.i >> 1;
         if (this.checkNavNode)
         {
             VInt  num3;
             VInt3 delta = num2 - handle.location;
             VInt3 num5  = PathfindingUtility.Move((ActorRoot)this.actor, delta, out num3, out handle.hasReachedNavEdge);
             VInt3 pos   = handle.location + num5;
             handle.location = pos;
             handle.groundY  = num3;
             this.rvoAgent.Teleport(pos);
             this.adjustedY = pos.y;
         }
         else
         {
             handle.location = num2;
         }
         this.lastPosition = handle.location;
         if (this.enableRotation && (this.velocity != VInt3.zero))
         {
             Vector3   velocity  = (Vector3)this.velocity;
             Transform transform = base.transform;
             transform.rotation = Quaternion.Lerp(transform.rotation, Quaternion.LookRotation(velocity), (dt * this.rotationSpeed) * Mathf.Min((float)this.velocity.magnitude, 0.2f));
         }
     }
 }
示例#13
0
 public override void Process(Action _action, Track _track, int _localTime)
 {
     if (this.actor_ != 0)
     {
         bool flag = this.lastTime_ < this.rotationTime;
         int  num  = _localTime - this.lastTime_;
         this.lastTime_ = _localTime;
         if (flag && this.enableRotate)
         {
             float      t          = Mathf.Min(1f, (float)(_localTime / this.rotationTime));
             Quaternion quaternion = Quaternion.Slerp(this.fromRot, this.toRot, t);
             this.actor_.handle.rotation = quaternion;
         }
         if (!this.done_)
         {
             VInt  num4;
             int   motionDeltaDistance = this.motionControler.GetMotionDeltaDistance(num);
             VInt3 delta = (VInt3)((this.moveDirection * motionDeltaDistance) / 1000f);
             VInt3 num6  = PathfindingUtility.Move(this.actor_.handle, delta, out num4);
             if (this.actor_.handle.MovementComponent.isFlying)
             {
                 int       y      = this.actor_.handle.location.y;
                 ActorRoot handle = this.actor_.handle;
                 handle.location += num6;
                 VInt3 location = this.actor_.handle.location;
                 location.y = y;
                 this.actor_.handle.location = location;
             }
             else
             {
                 ActorRoot local2 = this.actor_.handle;
                 local2.location += num6;
             }
             this.actor_.handle.groundY = num4;
             if ((delta.x != num6.x) || (delta.z != num6.z))
             {
                 this.done_ = true;
             }
             base.Process(_action, _track, _localTime);
         }
     }
 }
示例#14
0
        public void Teleport()
        {
            VInt  groundY = this.actor_.handle.groundY;
            VInt3 delta   = this.dir.NormalizeTo(this.moveDistance);
            VInt3 target  = this.actor_.handle.location + delta;

            if (PathfindingUtility.IsValidTarget((ActorRoot)this.actor_, target))
            {
                PathfindingUtility.GetGroundY(target, out groundY);
                target.y = groundY.i;
                this.actor_.handle.location = target;
            }
            else
            {
                delta = PathfindingUtility.Move(this.actor_.handle, delta, out groundY, out this.actor_.handle.hasReachedNavEdge);
                ActorRoot handle = this.actor_.handle;
                handle.location += delta;
            }
            this.actor_.handle.groundY = groundY;
            this.done_ = true;
        }
示例#15
0
        public override void Process(Action _action, Track _track, int _localTime)
        {
            if (this.done_ || !this.actor_)
            {
                return;
            }
            bool flag = this.lastTime_ < this.rotationTime;
            int  num  = _localTime - this.lastTime_;

            this.lastTime_ = _localTime;
            if (this.teleport)
            {
                this.Teleport();
                return;
            }
            if (flag)
            {
                float      t        = Mathf.Min(1f, (float)(_localTime / this.rotationTime));
                Quaternion rotation = Quaternion.Slerp(this.fromRot, this.toRot, t);
                this.actor_.get_handle().rotation = rotation;
            }
            if (this.moveTick - num <= 0)
            {
                num        = this.moveTick;
                this.done_ = true;
            }
            else
            {
                this.moveTick -= num;
            }
            VInt3 vInt = this.dir;
            VInt3 vInt2;

            if (!this.shouldUseAcceleration)
            {
                vInt2 = vInt.NormalizeTo(this.moveSpeed * num / 1000);
            }
            else
            {
                long num2 = (long)this.lastMoveSpeed * (long)num + (long)this.acceleration * (long)num * (long)num / 2L / 1000L;
                num2 /= 1000L;
                vInt2 = vInt.NormalizeTo((int)num2);
                this.lastMoveSpeed += this.acceleration * num / 1000;
            }
            VInt groundY = this.actor_.get_handle().groundY;

            if (!this.IgnoreCollision)
            {
                vInt2 = PathfindingUtility.Move(this.actor_.get_handle(), vInt2, out groundY, out this.actor_.get_handle().hasReachedNavEdge, null);
            }
            if (this.actor_.get_handle().MovementComponent.isFlying)
            {
                int y = this.actor_.get_handle().location.y;
                this.actor_.get_handle().location += vInt2;
                VInt3 location = this.actor_.get_handle().location;
                location.y = y;
                this.actor_.get_handle().location = location;
            }
            else
            {
                this.actor_.get_handle().location += vInt2;
            }
            this.actor_.get_handle().groundY = groundY;
            base.Process(_action, _track, _localTime);
        }
示例#16
0
 public override void Process(AGE.Action _action, Track _track, int _localTime)
 {
     if (!this.done_ && (this.actor_ != 0))
     {
         bool flag     = this.lastTime_ < this.rotationTime;
         int  moveTick = _localTime - this.lastTime_;
         this.lastTime_ = _localTime;
         if (this.teleport)
         {
             this.Teleport();
         }
         else
         {
             VInt3 num4;
             if (flag)
             {
                 float      t          = Mathf.Min(1f, (float)(_localTime / this.rotationTime));
                 Quaternion quaternion = Quaternion.Slerp(this.fromRot, this.toRot, t);
                 this.actor_.handle.rotation = quaternion;
             }
             if ((this.moveTick - moveTick) <= 0)
             {
                 moveTick   = this.moveTick;
                 this.done_ = true;
             }
             else
             {
                 this.moveTick -= moveTick;
             }
             VInt3 dir = this.dir;
             if (!this.shouldUseAcceleration)
             {
                 num4 = dir.NormalizeTo((this.moveSpeed * moveTick) / 0x3e8);
             }
             else
             {
                 long num5 = (this.lastMoveSpeed * moveTick) + ((((this.acceleration * moveTick) * moveTick) / 2L) / 0x3e8L);
                 num5 /= 0x3e8L;
                 num4  = dir.NormalizeTo((int)num5);
                 this.lastMoveSpeed += (this.acceleration * moveTick) / 0x3e8;
             }
             VInt groundY = this.actor_.handle.groundY;
             if (!this.IgnoreCollision)
             {
                 num4 = PathfindingUtility.Move(this.actor_.handle, num4, out groundY, out this.actor_.handle.hasReachedNavEdge, null);
             }
             if (this.actor_.handle.MovementComponent.isFlying)
             {
                 int       y      = this.actor_.handle.location.y;
                 ActorRoot handle = this.actor_.handle;
                 handle.location += num4;
                 VInt3 location = this.actor_.handle.location;
                 location.y = y;
                 this.actor_.handle.location = location;
             }
             else
             {
                 ActorRoot local2 = this.actor_.handle;
                 local2.location += num4;
             }
             this.actor_.handle.groundY = groundY;
             base.Process(_action, _track, _localTime);
         }
     }
 }
示例#17
0
    public void Move(out VInt3 targetDir, int dt)
    {
        targetDir = VInt3.forward;
        if (this.targetReached || !this.canMove)
        {
            return;
        }
        ActorRoot handle   = this.actor.get_handle();
        VInt3     location = handle.location;
        VInt3     vInt     = this.CaculateDir(location);

        if (this.targetDirection.x != 0 || this.targetDirection.z != 0)
        {
            targetDir = this.targetDirection;
            targetDir.NormalizeTo(1000);
        }
        else
        {
            targetDir = handle.forward;
        }
        VInt3 vInt2 = handle.location;
        VInt3 vInt3 = vInt;

        vInt3 *= this.speed * dt / 1000;
        vInt3 /= 1000f;
        bool flag = this.rvo != null && this.rvo.enabled;
        bool hasReachedNavEdge = false;

        if (this.checkNavNode && !flag)
        {
            VInt groundY;
            vInt3          = PathfindingUtility.Move(this.actor, vInt3, out groundY, out hasReachedNavEdge, null);
            handle.groundY = groundY;
        }
        if ((handle.location - this.targetPos).get_sqrMagnitudeLong2D() <= vInt3.get_sqrMagnitudeLong2D())
        {
            if (this.checkNavNode && !this.targetPosIsValid)
            {
                vInt2 = handle.location + vInt3;
            }
            else
            {
                vInt2 = this.targetPos;
            }
            this.targetReached = true;
            this.OnTargetReached();
        }
        else
        {
            vInt2 = handle.location + vInt3;
        }
        if (flag)
        {
            VInt3 vInt4 = vInt2 - handle.location;
            vInt4 = IntMath.Divide(vInt4, 1000L, (long)dt);
            this.rvo.Move(vInt4);
        }
        else
        {
            handle.location          = vInt2;
            handle.hasReachedNavEdge = hasReachedNavEdge;
        }
    }