示例#1
0
        protected virtual void MoveToTarget(int delta)
        {
            this.CalcSpeed(delta);
            MPathfinding pathfinding = this.Parent.Pathfinding;

            if (pathfinding != null && pathfinding.enabled)
            {
                pathfinding.speed = this.CurrentSpeed;
                VInt3 forward = VInt3.forward;
                pathfinding.Move(out forward, delta);
                base.UpdateRotateDir(forward, delta);
            }
            else
            {
                VInt3 location = this.Parent.actor.location;
                VInt3 lhs      = VInt3.MoveTowards(location, this.Parent.targetLocation, this.CurrentSpeed * delta / 1000);
                this.Parent.movingMode.Move(lhs - location);
                if (this.Parent.isRotateImmediately)
                {
                    this.PointingAtTarget(delta);
                }
            }
            this.Velocity = this.Parent.actor.forward * this.CurrentSpeed / 1000f;
            if (this.IsOnTarget())
            {
                this.Parent.GotoState("IdleMovmentState");
            }
            this.Parent.nLerpStep = 2;
        }
示例#2
0
        protected virtual void MoveToTarget(int delta)
        {
            this.CalcSpeed(delta);
            MPathfinding pathfinding = base.Parent.Pathfinding;

            if ((pathfinding != null) && pathfinding.enabled)
            {
                VInt3 num;
                pathfinding.speed = this.CurrentSpeed;
                pathfinding.Move(out num, delta);
                base.UpdateRotateDir(num, delta);
            }
            else
            {
                VInt3 location = base.Parent.actor.location;
                VInt3 num3     = VInt3.MoveTowards(location, base.Parent.targetLocation, (this.CurrentSpeed * delta) / 0x3e8);
                base.Parent.movingMode.Move(num3 - location);
                if (base.Parent.isRotateImmediately)
                {
                    this.PointingAtTarget(delta);
                }
            }
            base.Velocity = (VInt3)((base.Parent.actor.forward * this.CurrentSpeed) / 1000f);
            if (this.IsOnTarget())
            {
                base.Parent.GotoState("IdleMovmentState");
            }
            base.Parent.nLerpStep = 2;
        }
 public override void OnUse()
 {
     base.OnUse();
     this.ResetVariables();
     this.pathfinding = null;
     this.MovingState = null;
     this.MovingMode  = null;
     this.GravityMode = null;
 }
 public override void Init()
 {
     base.Init();
     this.GravityMode.Init();
     if (AstarPath.active != null)
     {
         this.pathfinding = new MPathfinding();
         if (!this.pathfinding.Init(this.actorPtr))
         {
             this.pathfinding = null;
         }
     }
 }