Beispiel #1
0
 // Token: 0x06002E36 RID: 11830 RVA: 0x000B0710 File Offset: 0x000AE910
 private void GatherInfo(global::CCMotor motor)
 {
     if (motor.isGrounded && !motor.isSliding)
     {
         this.groundLocalVelocity           = this.localVelocity;
         this.groundWorldVelocity           = this.worldVelocity;
         this.groundLocalAngularVelocity    = this.localAngularVelocity;
         this.groundLocalVelocityMag        = this.localVelocityMag;
         this.groundWorldVelocityMag        = this.worldVelocityMag;
         this.groundLocalAngularVelocityMag = this.localAngularVelocityMag;
     }
     else
     {
         this.groundLocalVelocity           = default(Vector3G);
         this.groundWorldVelocity           = default(Vector3G);
         this.groundLocalAngularVelocity    = default(Vector3G);
         this.groundLocalVelocityMag        = 0.0;
         this.groundWorldVelocityMag        = 0.0;
         this.groundLocalAngularVelocityMag = 0.0;
     }
     this.inputForce.x = (double)motor.input.moveDirection.x;
     this.inputForce.y = (double)motor.input.moveDirection.y;
     this.inputForce.z = (double)motor.input.moveDirection.z;
     Matrix4x4G.Mult3x3(ref this.inputForce, ref this.worldToLocal, ref this.inputForce);
     this.inputForce.x = this.inputForce.x * (double)this.cfg.inputForceMultiplier.x;
     this.inputForce.y = this.inputForce.y * (double)this.cfg.inputForceMultiplier.y;
     this.inputForce.z = this.inputForce.z * (double)this.cfg.inputForceMultiplier.z;
 }
 // Token: 0x060018E4 RID: 6372 RVA: 0x0005F4EC File Offset: 0x0005D6EC
 public void CopySettingsFrom(global::CCMotor motor)
 {
     this.jumping        = motor.jumping.setup;
     this.movement       = motor.movement.setup;
     this.movingPlatform = motor.movingPlatform.setup;
     this.sliding        = motor.sliding;
 }
Beispiel #3
0
 // Token: 0x060021E9 RID: 8681 RVA: 0x0007CF48 File Offset: 0x0007B148
 private void UnstickInvoke()
 {
     if (this.hasUnstickPosition)
     {
         try
         {
             if (this.unstickTransform)
             {
                 this.unstickTransform.position = this.nextUnstickPosition;
                 global::Character component = this.unstickTransform.GetComponent <global::Character>();
                 if (component)
                 {
                     global::CCMotor ccmotor = component.ccmotor;
                     if (ccmotor)
                     {
                         ccmotor.Teleport(this.nextUnstickPosition);
                     }
                 }
             }
         }
         finally
         {
             this.hasUnstickPosition = false;
         }
     }
 }
 // Token: 0x060018E3 RID: 6371 RVA: 0x0005F498 File Offset: 0x0005D698
 public void BindSettingsTo(global::CCMotor motor)
 {
     motor.jumping.setup        = this.jumping;
     motor.movement.setup       = this.movement;
     motor.movingPlatform.setup = this.movingPlatform;
     motor.sliding = this.sliding;
     motor.OnBindCCMotorSettings();
 }
 // Token: 0x06000A6A RID: 2666 RVA: 0x0002B114 File Offset: 0x00029314
 public void LocalPlayerUpdateCrouchState(global::CCMotor ccmotor, ref bool crouchFlag, ref bool crouchBlockFlag, ref global::Crouchable.Smoothing smoothing)
 {
     global::Crouchable.CrouchState crouchState;
     crouchState.CrouchBlocked = ccmotor.isCrouchBlocked;
     global::CCTotem.PositionPlacement?lastPositionPlacement = ccmotor.LastPositionPlacement;
     global::CCTotem.PositionPlacement positionPlacement     = (lastPositionPlacement == null) ? new global::CCTotem.PositionPlacement(base.origin, base.origin, base.origin, ccmotor.ccTotemPole.MaximumHeight) : lastPositionPlacement.Value;
     crouchState.BottomY = positionPlacement.bottom.y;
     crouchState.TopY    = positionPlacement.top.y;
     crouchState.InitialStandingHeight = positionPlacement.originalHeight;
     this.LocalPlayerUpdateCrouchState(ref crouchState, ref crouchFlag, ref crouchBlockFlag, ref smoothing);
 }
 // Token: 0x0600198B RID: 6539 RVA: 0x000624CC File Offset: 0x000606CC
 private bool RemoveMotor(global::CCMotor motor)
 {
     if (this.activeMotors == null || !this.activeMotors.Remove(motor))
     {
         return(false);
     }
     if (this.activeMotors.Count == 0)
     {
         this.activeMotors = null;
     }
     return(true);
 }
    // Token: 0x06001989 RID: 6537 RVA: 0x00062440 File Offset: 0x00060640
    private static bool GetCCMotor(Collision collision, out global::CCMotor ccmotor)
    {
        GameObject gameObject = collision.gameObject;

        if (gameObject.layer == 16)
        {
            ccmotor = gameObject.GetComponent <global::CCMotor>();
            return(ccmotor);
        }
        ccmotor = null;
        return(false);
    }
 // Token: 0x0600198A RID: 6538 RVA: 0x00062478 File Offset: 0x00060678
 private bool AddMotor(global::CCMotor motor)
 {
     if (this.activeMotors == null)
     {
         this.activeMotors = new HashSet <global::CCMotor>();
         this.activeMotors.Add(motor);
         return(true);
     }
     if (!this.activeMotors.Add(motor))
     {
         Debug.LogWarning("Already added motor?", this);
         return(false);
     }
     return(true);
 }
Beispiel #9
0
    // Token: 0x06000403 RID: 1027 RVA: 0x0001383C File Offset: 0x00011A3C
    private void UpdateStateNew(Vector3 origin, global::Angle2 eyesAngles, ushort stateFlags, double timestamp)
    {
        global::Character idMain = base.idMain;

        if (this.firstState)
        {
            this.firstState         = false;
            idMain.origin           = origin;
            idMain.eyesAngles       = eyesAngles;
            idMain.stateFlags.flags = stateFlags;
            return;
        }
        if (base.networkView.isMine)
        {
            idMain.origin           = origin;
            idMain.eyesAngles       = eyesAngles;
            idMain.stateFlags.flags = stateFlags;
            global::CCMotor ccmotor = base.ccmotor;
            if (ccmotor)
            {
                ccmotor.Teleport(origin);
            }
        }
        else
        {
            global::CharacterInterpolatorBase interpolator = base.interpolator;
            if (interpolator)
            {
                global::IStateInterpolator <global::CharacterStateInterpolatorData> stateInterpolator = interpolator as global::IStateInterpolator <global::CharacterStateInterpolatorData>;
                if (stateInterpolator != null)
                {
                    global::CharacterStateInterpolatorData characterStateInterpolatorData;
                    characterStateInterpolatorData.origin      = origin;
                    characterStateInterpolatorData.state.flags = stateFlags;
                    characterStateInterpolatorData.eyesAngles  = eyesAngles;
                    stateInterpolator.SetGoals(ref characterStateInterpolatorData, ref timestamp);
                }
                else
                {
                    idMain.stateFlags.flags = stateFlags;
                    interpolator.SetGoals(origin, eyesAngles.quat, timestamp);
                }
            }
        }
    }
Beispiel #10
0
    // Token: 0x060003FA RID: 1018 RVA: 0x00013440 File Offset: 0x00011640
    private void SetLocalOnlyComponentsEnabled(bool enable)
    {
        global::CCMotor component = base.GetComponent <global::CCMotor>();

        if (component)
        {
            component.enabled = enable;
            CharacterController characterController = base.collider as CharacterController;
            if (characterController)
            {
                characterController.enabled = enable;
            }
        }
        global::CameraMount componentInChildren = base.GetComponentInChildren <global::CameraMount>();

        if (componentInChildren)
        {
            componentInChildren.open = enable;
            global::HeadBob component2 = componentInChildren.GetComponent <global::HeadBob>();
            if (component2)
            {
                component2.enabled = enable;
            }
            global::LazyCam component3 = componentInChildren.GetComponent <global::LazyCam>();
            if (component3)
            {
                component3.enabled = enable;
            }
        }
        global::LocalDamageDisplay component4 = base.GetComponent <global::LocalDamageDisplay>();

        if (component4)
        {
            component4.enabled = enable;
        }
    }
Beispiel #11
0
    // Token: 0x060003F0 RID: 1008 RVA: 0x00012AD8 File Offset: 0x00010CD8
    private void ProcessInput(ref global::HumanController.InputSample sample)
    {
        global::CCMotor ccmotor = base.ccmotor;
        bool            flag;
        bool            flag2;

        if (ccmotor)
        {
            flag  = ccmotor.isGrounded;
            flag2 = ccmotor.isSliding;
            if (!flag && !flag2)
            {
                sample.sprint = false;
                sample.crouch = false;
                sample.aim    = false;
                sample.info__crouchBlocked = false;
                if (!this.wasInAir)
                {
                    this.wasInAir       = true;
                    this.magnitudeAir   = ccmotor.input.moveDirection.magnitude;
                    this.midairStartPos = base.transform.position;
                }
                this.lastFrameVelocity = ccmotor.velocity;
            }
            else if (this.wasInAir)
            {
                this.wasInAir                = false;
                this.magnitudeAir            = 1f;
                this.landingSpeedPenaltyTime = 0f;
                if (base.transform.position.y < this.midairStartPos.y && Mathf.Abs(base.transform.position.y - this.midairStartPos.y) > 2f)
                {
                    base.idMain.GetLocal <global::FallDamage>().SendFallImpact(this.lastFrameVelocity);
                }
                this.lastFrameVelocity = Vector3.zero;
                this.midairStartPos    = Vector3.zero;
            }
            bool flag3 = sample.crouch || sample.info__crouchBlocked;
            global::CCMotor.InputFrame input;
            input.jump            = sample.jump;
            input.moveDirection.x = sample.strafe;
            input.moveDirection.y = 0f;
            input.moveDirection.z = sample.walk;
            input.crouchSpeed     = ((!sample.crouch) ? 1f : -1f);
            if (input.moveDirection != Vector3.zero)
            {
                float num = input.moveDirection.magnitude;
                if (num < 1f)
                {
                    input.moveDirection /= num;
                    num *= num;
                    input.moveDirection *= num;
                }
                else if (num > 1f)
                {
                    input.moveDirection /= num;
                }
                if (global::HumanController.InputSample.MovementScale < 1f)
                {
                    if (global::HumanController.InputSample.MovementScale > 0f)
                    {
                        input.moveDirection *= global::HumanController.InputSample.MovementScale;
                    }
                    else
                    {
                        input.moveDirection = Vector3.zero;
                    }
                }
                Vector3 moveDirection = input.moveDirection;
                moveDirection.x *= this.controlConfig.sprintScaleX;
                moveDirection.z *= this.controlConfig.sprintScaleY;
                float advance;
                if (sample.sprint && !flag3 && !sample.aim)
                {
                    advance = Time.deltaTime * this.sprintInMulTime;
                }
                else
                {
                    sample.sprint = false;
                    advance       = -Time.deltaTime;
                }
                input.moveDirection += moveDirection * this.controlConfig.curveSprintAddSpeedByTime.EvaluateClampedTime(ref this.sprintTime, advance);
                float advance2;
                if (flag3)
                {
                    advance2 = Time.deltaTime * this.crouchInMulTime;
                }
                else
                {
                    advance2 = -Time.deltaTime;
                }
                input.moveDirection *= this.controlConfig.curveCrouchMulSpeedByTime.EvaluateClampedTime(ref this.crouchTime, advance2);
                input.moveDirection  = base.transform.TransformDirection(input.moveDirection);
                if (this.wasInAir)
                {
                    float magnitude = input.moveDirection.magnitude;
                    if (!Mathf.Approximately(magnitude, this.magnitudeAir))
                    {
                        input.moveDirection /= magnitude;
                        input.moveDirection *= this.magnitudeAir;
                    }
                }
                else
                {
                    input.moveDirection *= this.controlConfig.curveLandingSpeedPenalty.EvaluateClampedTime(ref this.landingSpeedPenaltyTime, Time.deltaTime);
                }
            }
            else
            {
                this.sprinting     = false;
                this.exitingSprint = false;
                this.sprintTime    = 0f;
                this.crouchTime    = ((!sample.crouch) ? 0f : this.controlConfig.curveCrouchMulSpeedByTime.GetEndTime());
                this.magnitudeAir  = 1f;
            }
            if (global::DebugInput.GetKey(104))
            {
                input.moveDirection *= 100f;
            }
            ccmotor.input = input;
            if (ccmotor.stepMode == global::CCMotor.StepMode.Elsewhere)
            {
                ccmotor.Step();
            }
        }
        else
        {
            flag2 = false;
            flag  = true;
        }
        global::Character  idMain     = base.idMain;
        global::Crouchable crouchable = idMain.crouchable;

        if (idMain)
        {
            global::Angle2 eyesAngles = base.eyesAngles;
            eyesAngles.yaw   = Mathf.DeltaAngle(0f, base.eyesAngles.yaw + sample.yaw);
            eyesAngles.pitch = base.ClampPitch(eyesAngles.pitch + sample.pitch);
            base.eyesAngles  = eyesAngles;
            ushort flags = idMain.stateFlags.flags;
            if (crouchable)
            {
                this.crouch_smoothing.AddSeconds((double)Time.deltaTime);
                crouchable.LocalPlayerUpdateCrouchState(ccmotor, ref sample.crouch, ref sample.info__crouchBlocked, ref this.crouch_smoothing);
            }
            int num2 = ((!sample.aim) ? 0 : 4) | ((!sample.sprint) ? 0 : 2) | ((!sample.attack) ? 0 : 8) | ((!sample.attack2) ? 0 : 256) | ((!sample.crouch) ? 0 : 1) | ((sample.strafe == 0f && sample.walk == 0f) ? 0 : 64) | ((!LockCursorManager.IsLocked()) ? 128 : 0) | ((!flag) ? 16 : 0) | ((!flag2) ? 0 : 32) | ((!this.bleeding) ? 0 : 512) | ((!sample.lamp) ? 0 : 2048) | ((!sample.laser) ? 0 : 4096) | ((!sample.info__crouchBlocked) ? 0 : 1024);
            idMain.stateFlags = num2;
            if ((int)flags != num2)
            {
                idMain.Signal_State_FlagsChanged(false);
            }
        }
        this.crouch_was_blocked = sample.info__crouchBlocked;
        if (sample.inventory)
        {
            global::RPOS.Toggle();
        }
        if (Input.GetKeyDown(27))
        {
            global::RPOS.Hide();
        }
    }
 // Token: 0x0600198C RID: 6540 RVA: 0x00062510 File Offset: 0x00060710
 private bool ContainsMotor(global::CCMotor motor)
 {
     return(this.activeMotors != null && this.activeMotors.Contains(motor));
 }