Пример #1
0
        // Token: 0x060017B9 RID: 6073 RVA: 0x00070D64 File Offset: 0x0006EF64
        private void AddTravelCallback(WormBodyPositions2.TravelCallback newTravelCallback)
        {
            int   index = this.travelCallbacks.Count;
            float time  = newTravelCallback.time;

            for (int i = 0; i < this.travelCallbacks.Count; i++)
            {
                if (time < this.travelCallbacks[i].time)
                {
                    index = i;
                    break;
                }
            }
            this.travelCallbacks.Insert(index, newTravelCallback);
        }
Пример #2
0
 // Token: 0x060017C2 RID: 6082 RVA: 0x00071338 File Offset: 0x0006F538
 private void FixedUpdate()
 {
     if (NetworkServer.active)
     {
         this.enterTriggerCooldownTimer -= Time.fixedDeltaTime;
         this.exitTriggerCooldownTimer  -= Time.fixedDeltaTime;
         Vector3 position   = this.referenceTransform.position;
         float   d          = this.characterBody.moveSpeed * this.speedMultiplier;
         Vector3 normalized = (position - this.chasePosition).normalized;
         float   num        = (this.underground ? this.maxTurnSpeed : (this.maxTurnSpeed * this.turnRateCoefficientAboveGround)) * 0.017453292f;
         Vector3 vector     = new Vector3(this.velocity.x, 0f, this.velocity.z);
         Vector3 a          = new Vector3(normalized.x, 0f, normalized.z);
         vector = Vector3.RotateTowards(vector, a * d, num * Time.fixedDeltaTime, float.PositiveInfinity);
         vector = vector.normalized * d;
         float num2 = position.y - this.chasePosition.y;
         float num3 = -this.velocity.y * this.yDamperConstant;
         float num4 = num2 * this.ySpringConstant;
         if (Mathf.Abs(this.velocity.y) < this.yShoveVelocityThreshold && Mathf.Abs(num2) < this.yShovePositionThreshold)
         {
             this.velocity.y = this.velocity.y + this.yShoveForce * Time.fixedDeltaTime;
         }
         if (!this.underground)
         {
             num4 *= this.wormForceCoefficientAboveGround;
             num3 *= this.wormForceCoefficientAboveGround;
         }
         this.velocity.y     = this.velocity.y + (num4 + num3) * Time.fixedDeltaTime;
         this.velocity      += Physics.gravity * Time.fixedDeltaTime;
         this.velocity       = new Vector3(vector.x, this.velocity.y, vector.z);
         this.chasePosition += this.velocity * Time.fixedDeltaTime;
         this.chasePositionVisualizer.position = this.chasePosition;
         this.underground              = (-num2 < this.undergroundTestYOffset);
         this.keyFrameGenerationTimer -= Time.deltaTime;
         if (this.keyFrameGenerationTimer <= 0f)
         {
             this.keyFrameGenerationTimer = this.keyFrameGenerationInterval;
             this.AttemptToGenerateKeyFrame(this.chasePosition);
         }
         this.SurfaceTest();
         float synchronizedTimeStamp = WormBodyPositions2.GetSynchronizedTimeStamp();
         while (this.travelCallbacks.Count > 0 && this.travelCallbacks[0].time <= synchronizedTimeStamp)
         {
             ref WormBodyPositions2.TravelCallback ptr = this.travelCallbacks[0];
             this.travelCallbacks.RemoveAt(0);
             ptr.callback();
         }
     }