示例#1
0
文件: Physics.cs 项目: tarsupin/Nexus
        // Run this method BEFORE any collisions take place. The .result value will change from collisions.
        public void RunPhysicsTick()
        {
            this.touch.ResetTouch();

            if (this.touch.onMover)
            {
                this.touch.ProcessMover(this);
            }

            // Update Last Positions
            this.lastPosX = this.actor.posX;
            this.lastPosY = this.actor.posY;

            // Apply Gravity to Velocity
            this.velocity.Y += this.gravity;

            // Determine what the intended movement is for this frame.
            this.intend = this.velocity;

            if (this.hasExtraMovement)
            {
                this.intend           = FVector.VectorAdd(this.intend, this.extraMovement);
                this.extraMovement    = new FVector();
                this.hasExtraMovement = false;
            }

            this.TrackPhysicsTick();
        }
示例#2
0
文件: Physics.cs 项目: tarsupin/Nexus
 public void TrackPhysicsTick()
 {
     this.physPos    = FVector.VectorAdd(this.physPos, this.intend);
     this.actor.posX = this.physPos.X.RoundInt;
     this.actor.posY = this.physPos.Y.RoundInt;
 }