Beispiel #1
0
 private void Start()
 {
     if (!input)
     {
         input = FindObjectOfType <DebugInput>();
     }
 }
Beispiel #2
0
    void Update()
    {
        if (DebugInput.GetKey(KeyCode.LeftShift) && DebugInput.GetKeyDown(KeyCode.G))
        {
            ToggleNoClip();
        }

        if (noClipOn)
        {
            if (DebugInput.GetKeyDown(KeyCode.LeftShift))
            {
                desiredSpeed = (desiredSpeed == sprintSpeed) ? moveSpeed : sprintSpeed;
            }
            else if (DebugInput.GetKeyDown(KeyCode.LeftControl))
            {
                desiredSpeed = (desiredSpeed == slowMoveSpeed) ? moveSpeed : slowMoveSpeed;
            }

            Vector2 moveInput = input.LeftStick;

            Vector3 moveDirection = playerCamera.forward * moveInput.y + playerCamera.right * moveInput.x;

            speed = Mathf.Lerp(speed, desiredSpeed, Time.deltaTime * 6f);
            float   middleMouseScroll = Input.mouseScrollDelta.y;
            Vector3 verticalScroll    = transform.up * (middleMouseScroll * middleMouseVerticalSpeed);

            transform.position += (verticalScroll + moveDirection) * (Time.deltaTime * speed);
        }
    }
 void Update()
 {
     if (DebugInput.GetKeyDown(modeSwitchKey))
     {
         debugMode = (DebugMode)(((int)debugMode + 1) % NUM_MODES);
     }
 }
 void OnGUI()
 {
     GUILayout.BeginHorizontal(GUILayout.Width(Screen.width));
     {
         GUILayout.FlexibleSpace();
         for (int controller = 0; controller < OuyaController.MAX_CONTROLLERS; ++controller)
         {
             GUILayout.BeginVertical(GUILayout.Height(Screen.height));
             {
                 foreach (int axis in _axises)
                 {
                     GUILayout.Label(string.Format("({0}) {1} val={2}",
                                                   axis,
                                                   DebugInput.DebugGetAxisName(axis),
                                                   GetAxis(controller, axis, _axis)));
                 }
                 GUILayout.FlexibleSpace();
                 foreach (int button in _buttons)
                 {
                     GUILayout.Label(string.Format("({0}) {1} up={2} down={3}",
                                                   button,
                                                   DebugInput.DebugGetButtonName(button),
                                                   CheckButton(controller, button, _buttonUp),
                                                   CheckButton(controller, button, _buttonDown)));
                 }
             }
             GUILayout.EndVertical();
         }
         GUILayout.FlexibleSpace();
     }
     GUILayout.EndHorizontal();
 }
 // Update is called once per frame
 void Update()
 {
     // DEBUG
     if (DebugInput.GetKey(KeyCode.LeftShift) && DebugInput.GetKeyDown("o"))
     {
         StartCoroutine(DoorOpen());
     }
 }
Beispiel #6
0
        internal DebugInput(Game game) {
            Game = game;

            Instance = this;

#if DEBUG
            Enabled = true;
#endif
        }
Beispiel #7
0
        internal DebugInput(Game game)
        {
            Game = game;

            Instance = this;

#if DEBUG
            Enabled = true;
#endif
        }
Beispiel #8
0
 void Update()
 {
     if (DebugInput.GetKey(KeyCode.LeftShift) && DebugInput.GetKeyDown(KeyCode.B))
     {
         ToggleDebugMode();
     }
     if (DebugInput.GetKey(KeyCode.LeftShift) && DebugInput.GetKeyDown(KeyCode.V))
     {
         ToggleDoubleSidedEdges();
     }
 }
 // Start is called before the first frame update
 void Start()
 {
     if (!globalInput)
     {
         globalInput = FindObjectOfType <DebugInput>();
     }
     animator      = GetComponentInChildren <Animator>();
     playerElement = new Element(startingType);
     sprite        = GetComponentInChildren <SpriteRenderer>();
     UpdateColor();
 }
    void Update()
    {
        if (DebugInput.GetKey(KeyCode.LeftShift) && DebugInput.GetKeyDown(KeyCode.F5))
        {
            limitFramerate = !limitFramerate;
        }

        if (limitFramerate)
        {
            WasteTime();
        }
    }
Beispiel #11
0
        // Update is called once per frame
        void Update()
        {
            if (state == State.Depowered && mainPower.state == PowerTrail.PowerTrailState.powered)
            {
                state.Set(State.Powering);
            }

            if (DebugInput.GetKeyDown(KeyCode.Alpha0))
            {
                state.Set((State)(2 - (int)state.state));
            }

            UpdateMiniSpotlights();
            UpdatePuzzleIsSolvedIndicator();
            UpdateDissolveLaser();
            UpdateGridColors();
        }
        // Update is called once per frame
        void Update()
        {
            if (!DEBUG)
            {
                return;
            }

            if (DebugInput.GetKey(KeyCode.LeftShift) && DebugInput.GetKeyDown(KeyCode.R) && !inBridgeRiseCoroutine)
            {
                ResetBridgePiecePositions();
            }

            else if (DebugInput.GetKeyDown(KeyCode.R) && !inBridgeRiseCoroutine)
            {
                StartCoroutine(BridgeRise());
            }
        }
 private void Update()
 {
     if (DebugInput.GetKeyDown(KeyCode.O))
     {
         LocalDamageDisplay.adminObjectShow = !LocalDamageDisplay.adminObjectShow;
         if (!LocalDamageDisplay.adminObjectShow)
         {
             Debug.Log("hid object overlay", this);
         }
         else
         {
             Debug.Log("shown object overlay", this);
         }
     }
     if (LocalDamageDisplay.adminObjectShow && DebugInput.GetKeyDown(KeyCode.L))
     {
         LocalDamageDisplay.mode = (LocalDamageDisplay.mode + 1) % 2;
     }
 }
Beispiel #14
0
        // Update is called once per frame
        void Update()
        {
            // Debug controls
            if (DEBUG)
            {
                if (DebugInput.GetKey("f"))
                {
                    if (DebugInput.GetKey(KeyCode.LeftShift))
                    {
                        DecreaseFrustumSize();
                    }
                    else
                    {
                        IncreaseFrustumSize();
                    }
                }
                if (DebugInput.GetKey("g"))
                {
                    ChangeAngle(DebugInput.GetKey(KeyCode.LeftShift) ? -rotationSpeed : rotationSpeed);
                }
                if (DebugInput.GetKey("h"))
                {
                    RotateAroundCircumference(DebugInput.GetKey(KeyCode.LeftShift) ? -1 : 1);
                }
                if (DebugInput.GetKey("j"))
                {
                    MoveProjectorVertical(DebugInput.GetKey(KeyCode.LeftShift) ? -verticalMovespeed : verticalMovespeed);
                }
            }

            if (upAndDownAnim != null)
            {
                curUpAndDownAnimTime = Mathf.Lerp(curUpAndDownAnimTime, desiredUpAndDownAnimTime, upAndDownAnimLerpSpeed * Time.deltaTime);
                upAndDownAnim.Play("ProjectorUpDown", 0, curUpAndDownAnimTime);
            }
            if (sideToSideAnim != null)
            {
                curSideToSideAnimTime = Mathf.Lerp(curSideToSideAnimTime, desiredSideToSideAnimTime, sideToSideAnimLerpSpeed * Time.deltaTime);
                sideToSideAnim.Play("ProjectorSideToSide", 1, curSideToSideAnimTime);
            }

            curCircumferenceRotation = Quaternion.Lerp(curCircumferenceRotation, desiredCircumferenceRotation, circumferenceRotationLerpSpeed * Time.deltaTime);
        }
 private void Update()
 {
     if (DebugInput.GetKeyDown(KeyCode.O))
     {
         adminObjectShow = !adminObjectShow;
         if (adminObjectShow)
         {
             Debug.Log("shown object overlay", this);
         }
         else
         {
             Debug.Log("hid object overlay", this);
         }
     }
     if (adminObjectShow && DebugInput.GetKeyDown(KeyCode.L))
     {
         mode = (mode + 1) % 2;
     }
 }
 private void OnDisable()
 {
     this.instance = null;
 }
Beispiel #17
0
 public void SetUp()
 {
     input  = new DebugInput();
     output = new DebugOutput();
     i      = new Interpreter(64 * 1024, input, output);
 }
Beispiel #18
0
        internal DebugInput(Game game)
        {
            Game = game;

            Instance = this;
        }
Beispiel #19
0
    void Update()
    {
        if (Time.timeScale == 0)
        {
            return;
        }

#if UNITY_EDITOR
        if (DEBUG && DebugInput.GetKeyDown("c"))
        {
            if (!isShaking)
            {
                Shake(2, 1, 0);
            }
            else
            {
                CancelShake();
            }
        }
#endif

        if (!isShaking)
        {
            if (totalOffsetApplied.magnitude > 0.001f)
            {
                Vector2 nextTotalOffsetApplied = Vector2.Lerp(totalOffsetApplied, Vector2.zero, returnToCenterLerpSpeed * Time.deltaTime);
                Vector2 offset = nextTotalOffsetApplied - totalOffsetApplied;
                transform.localPosition += new Vector3(offset.x, offset.y, 0);
                totalOffsetApplied       = nextTotalOffsetApplied;
            }
            else if (totalOffsetApplied.magnitude > 0f)
            {
                transform.localPosition -= new Vector3(totalOffsetApplied.x, totalOffsetApplied.y, 0);
                totalOffsetApplied       = Vector2.zero;
            }
        }
        else
        {
            if (timeShaking < duration)
            {
                float t = timeShaking / duration;

                intensity = isUsingCurve ? curve.Evaluate(t) * intensityMultiplier : Mathf.Lerp(startIntensity, endIntensity, t);
                Vector2 random = UnityEngine.Random.insideUnitCircle * intensity / 10f;
                Vector2 offset = Vector2.Lerp(Vector2.zero, -appliedOffset, t) + random;

                appliedOffset           += offset;
                transform.localPosition += new Vector3(offset.x, offset.y, 0);
                totalOffsetApplied      += offset;

                timeShaking += Time.deltaTime;
            }
            else
            {
                transform.localPosition -= new Vector3(appliedOffset.x, appliedOffset.y, 0);
                totalOffsetApplied      -= appliedOffset;

                isShaking = false;
            }
        }
    }
Beispiel #20
0
    private void ProcessInput(ref HumanController.InputSample sample)
    {
        bool flag;
        bool flag1;

        CCMotor.InputFrame movementScale = new CCMotor.InputFrame();
        float   single;
        float   single1;
        CCMotor cCMotor = base.ccmotor;

        if (!cCMotor)
        {
            flag1 = false;
            flag  = true;
        }
        else
        {
            flag  = cCMotor.isGrounded;
            flag1 = cCMotor.isSliding;
            if (!flag && !flag1)
            {
                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 <FallDamage>().SendFallImpact(this.lastFrameVelocity);
                }
                this.lastFrameVelocity = Vector3.zero;
                this.midairStartPos    = Vector3.zero;
            }
            bool flag2 = (sample.crouch ? true : sample.info__crouchBlocked);
            movementScale.jump            = sample.jump;
            movementScale.moveDirection.x = sample.strafe;
            movementScale.moveDirection.y = 0f;
            movementScale.moveDirection.z = sample.walk;
            movementScale.crouchSpeed     = (!sample.crouch ? 1f : -1f);
            if (movementScale.moveDirection == Vector3.zero)
            {
                this.sprinting     = false;
                this.exitingSprint = false;
                this.sprintTime    = 0f;
                this.crouchTime    = (!sample.crouch ? 0f : this.controlConfig.curveCrouchMulSpeedByTime.GetEndTime());
                this.magnitudeAir  = 1f;
            }
            else
            {
                float single2 = movementScale.moveDirection.magnitude;
                if (single2 < 1f)
                {
                    movementScale.moveDirection = movementScale.moveDirection / single2;
                    single2 = single2 * single2;
                    movementScale.moveDirection = movementScale.moveDirection * single2;
                }
                else if (single2 > 1f)
                {
                    movementScale.moveDirection = movementScale.moveDirection / single2;
                }
                if (HumanController.InputSample.MovementScale < 1f)
                {
                    if (HumanController.InputSample.MovementScale <= 0f)
                    {
                        movementScale.moveDirection = Vector3.zero;
                    }
                    else
                    {
                        movementScale.moveDirection = movementScale.moveDirection * HumanController.InputSample.MovementScale;
                    }
                }
                Vector3 vector3 = movementScale.moveDirection;
                vector3.x = vector3.x * this.controlConfig.sprintScaleX;
                vector3.z = vector3.z * this.controlConfig.sprintScaleY;
                if (!sample.sprint || flag2 || sample.aim)
                {
                    sample.sprint = false;
                    single        = -Time.deltaTime;
                }
                else
                {
                    single = Time.deltaTime * this.sprintInMulTime;
                }
                movementScale.moveDirection = movementScale.moveDirection + (vector3 * this.controlConfig.curveSprintAddSpeedByTime.EvaluateClampedTime(ref this.sprintTime, single));
                single1 = (!flag2 ? -Time.deltaTime : Time.deltaTime * this.crouchInMulTime);
                movementScale.moveDirection = movementScale.moveDirection * this.controlConfig.curveCrouchMulSpeedByTime.EvaluateClampedTime(ref this.crouchTime, single1);
                movementScale.moveDirection = base.transform.TransformDirection(movementScale.moveDirection);
                if (!this.wasInAir)
                {
                    movementScale.moveDirection = movementScale.moveDirection * this.controlConfig.curveLandingSpeedPenalty.EvaluateClampedTime(ref this.landingSpeedPenaltyTime, Time.deltaTime);
                }
                else
                {
                    float single3 = movementScale.moveDirection.magnitude;
                    if (!Mathf.Approximately(single3, this.magnitudeAir))
                    {
                        movementScale.moveDirection = movementScale.moveDirection / single3;
                        movementScale.moveDirection = movementScale.moveDirection * this.magnitudeAir;
                    }
                }
            }
            if (DebugInput.GetKey(KeyCode.H))
            {
                movementScale.moveDirection = movementScale.moveDirection * 100f;
            }
            cCMotor.input = movementScale;
            if (cCMotor.stepMode == CCMotor.StepMode.Elsewhere)
            {
                cCMotor.Step();
            }
        }
        Character  character  = base.idMain;
        Crouchable crouchable = character.crouchable;

        if (character)
        {
            Angle2 angle2  = base.eyesAngles;
            Angle2 angle21 = base.eyesAngles;
            angle2.yaw      = Mathf.DeltaAngle(0f, angle21.yaw + sample.yaw);
            angle2.pitch    = base.ClampPitch(angle2.pitch + sample.pitch);
            base.eyesAngles = angle2;
            ushort num = character.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 num1 = (!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 ? 64 : 0) | (!LockCursorManager.IsLocked() ? 128 : 0) | (!flag ? 16 : 0) | (!flag1 ? 0 : 32) | (!this.bleeding ? 0 : 512) | (!sample.lamp ? 0 : 2048) | (!sample.laser ? 0 : 4096) | (!sample.info__crouchBlocked ? 0 : 1024);
            character.stateFlags = num1;
            if (num != num1)
            {
                character.Signal_State_FlagsChanged(false);
            }
        }
        this.crouch_was_blocked = sample.info__crouchBlocked;
        if (sample.inventory)
        {
            RPOS.Toggle();
        }
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            RPOS.Hide();
        }
    }
Beispiel #21
0
        internal DebugInput(Game game) {
            Game = game;

            Instance = this;
        }
Beispiel #22
0
 private void UpdateLabelButton(out string field, int button)
 {
     field = DebugInput.DebugGetButtonName(button) + "=" + OuyaSDK.OuyaInput.GetButton(PlayerNum, button);
 }
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        DebugInput myTarget = (DebugInput)target;

        EditorGUILayout.LabelField("Debug keys for testing purposes. These will be automatically disabled on builds.", EditorStyles.helpBox);

        /* Not needed anymore
         * if (GUILayout.Button("Open DebugInput.cs"))
         * {
         *  MonoScript monoscript = MonoScript.FromMonoBehaviour(myTarget);
         *  string scriptPath = AssetDatabase.GetAssetPath(monoscript);
         *  UnityEditorInternal.InternalEditorUtility.OpenFileAtLineExternal(scriptPath, 0);
         * }
         */

        EditorGUILayout.Space();

        EditorGUILayout.LabelField("Key Bindings", EditorStyles.boldLabel);

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("Kill Current Character");
        myTarget.keyKillCurrentCharacter = EditorGUILayout.TextField(myTarget.keyKillCurrentCharacter, GUILayout.Width(30));
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("Warp Target To Current");
        myTarget.keyWarpTargetToCurrent = EditorGUILayout.TextField(myTarget.keyWarpTargetToCurrent, GUILayout.Width(30));
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("Display Comment On Target");
        myTarget.keyChangeCommentOfTargetChar = EditorGUILayout.TextField(myTarget.keyChangeCommentOfTargetChar, GUILayout.Width(30));
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("Move Target Left");
        myTarget.keyMoveTargetCharLeft = EditorGUILayout.TextField(myTarget.keyMoveTargetCharLeft, GUILayout.Width(30));
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("Move Target Right");
        myTarget.keyMoveTargetCharRight = EditorGUILayout.TextField(myTarget.keyMoveTargetCharRight, GUILayout.Width(30));
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("Run With Target");
        myTarget.keyRunWithTargetChar = EditorGUILayout.TextField(myTarget.keyRunWithTargetChar, GUILayout.Width(30));
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("Spawn Random Character");
        myTarget.keySpawnRandomCharacter = EditorGUILayout.TextField(myTarget.keySpawnRandomCharacter, GUILayout.Width(30));
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("Spawn Random Character Randomly");
        myTarget.keySpawnRandomCharacterSomewhere = EditorGUILayout.TextField(myTarget.keySpawnRandomCharacterSomewhere, GUILayout.Width(30));
        EditorGUILayout.EndHorizontal();

        /* Buttons
         * EditorGUILayout.Space();
         *
         * EditorGUILayout.LabelField("Quick Actions", EditorStyles.boldLabel);
         *
         * if (GUILayout.Button("Warp Target To Current Position"))
         * {
         *  myTarget.WarpTargetToCurrent();
         * }
         * if (GUILayout.Button("Spawn Random Character Somewhere"))
         * {
         *  myTarget.SpawnRandomCharacter(false);
         * }
         */

        EditorGUILayout.Space();

        EditorGUILayout.LabelField("Objects", EditorStyles.boldLabel);

        EditorGUILayout.BeginHorizontal();
        //EditorGUILayout.LabelField("Target Character");
        myTarget.targetChar = EditorGUILayout.ObjectField("Target Character", myTarget.targetChar, typeof(GameObject), true) as GameObject;
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("List Of Characters (asset)");
        myTarget.listOfCharacters = EditorGUILayout.ObjectField(myTarget.listOfCharacters, typeof(Characters), false, GUILayout.ExpandWidth(true)) as Characters;
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.Space();

        GUIStyle redLabel = new GUIStyle(EditorStyles.helpBox);

        redLabel.normal.textColor = new Color(0.5f, 0, 0);
        EditorGUILayout.LabelField("Notice: Interaction with spawned characters will not work perfectly yet.", redLabel);
    }
Beispiel #24
0
 public void SetUp()
 {
     input = new DebugInput();
     output = new DebugOutput();
     i = new Interpreter(64 * 1024, input, output);
 }
Beispiel #25
0
 private void UpdateLabelAxis(out string field, int axis)
 {
     field = DebugInput.DebugGetAxisName(axis) + "=" + OuyaSDK.OuyaInput.GetAxis(PlayerNum, axis);
 }
 private void OnDisable()
 {
     this.instance = null;
 }
 /// <summary>
 ///   Called when the inspector gets active.
 /// </summary>
 public void OnEnable()
 {
     this.instance       = this.target as DebugInput;
     this.propertyFields = this.instance != null?ExposeProperties.GetProperties(this.instance) : null;
 }
Beispiel #28
0
        /// <summary>
        /// Creates a new game to run in the program.
        /// </summary>
        /// <param name="title">The title of the window.</param>
        /// <param name="width">The width of the internal game resolution.</param>
        /// <param name="height">The height of the internal game resolution.</param>
        /// <param name="targetFramerate">The target framerate (for fixed framerate.)</param>
        /// <param name="fullscreen">Run the game in fullscreen.</param>
        public Game(string title = "Game", int width = 640, int height = 480, int targetFramerate = 60, bool fullscreen = false)
        {
            Sessions = new List <Session>();
            Scenes   = new Stack <Scene>();
            Surfaces = new List <Surface>();

            SaveData              = new DataSaver(Filepath);
            OptionsData           = new DataSaver(Filepath);
            ConfigData            = new DataSaver(Filepath);
            ConfigData.ExportMode = DataSaver.DataExportMode.Config;
            GameFolder            = "ottergame";

            QuitButton.AddKey(Key.Escape);

            cameraZoom       = 1;
            cameraAngle      = 0;
            Width            = width;
            Height           = height;
            this.title       = title;
            WindowWidth      = width;
            WindowHeight     = height;
            WindowFullscreen = fullscreen;

            ShowDebugger = false;

            TargetFramerate = (int)Util.Clamp(targetFramerate, 999);

            Surface = new Surface(width, height);
            Surface.CenterOrigin();
            Surface.Game = this;

            AspectRatio = width / (float)height;

            Draw.Target     = Surface;
            Draw.GameTarget = Surface;

            Input      = new Input(this);
            DebugInput = new DebugInput(this);
            Coroutine  = new Coroutine(this);
            Tweener    = new Tweener();

            for (int i = 0; i < fpsLogSize; i++)
            {
                fpsTimes.Add(targetFramerate);
            }

            frameTime = 1000f / TargetFramerate;
            skipTime  = frameTime * 2;

#if DEBUG
            try
            {
                Console.Title = string.Format("{0} Debug Console ᶜ(ᵔᴥᵔ)ᵓ", title);
            }
            catch
            {
                // No console
            }
            Console.WriteLine("[ Otter is running in debug mode! ]");
            Debugger = new Utility.Debugger(this);
#endif

            HasFocus = true;

            Instance = this;
        }
Beispiel #29
0
    private void ProcessInput(ref InputSample sample)
    {
        bool    isGrounded;
        bool    isSliding;
        CCMotor ccmotor = base.ccmotor;

        if (ccmotor != null)
        {
            CCMotor.InputFrame frame;
            isGrounded = ccmotor.isGrounded;
            isSliding  = ccmotor.isSliding;
            if (!isGrounded && !isSliding)
            {
                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((float)(base.transform.position.y - this.midairStartPos.y)) > 2f))
                {
                    base.idMain.GetLocal <FallDamage>().SendFallImpact(this.lastFrameVelocity);
                }
                this.lastFrameVelocity = Vector3.zero;
                this.midairStartPos    = Vector3.zero;
            }
            bool flag3 = sample.crouch || sample.info__crouchBlocked;
            frame.jump            = sample.jump;
            frame.moveDirection.x = sample.strafe;
            frame.moveDirection.y = 0f;
            frame.moveDirection.z = sample.walk;
            frame.crouchSpeed     = !sample.crouch ? 1f : -1f;
            if (frame.moveDirection != Vector3.zero)
            {
                float num2;
                float num3;
                float magnitude = frame.moveDirection.magnitude;
                if (magnitude < 1f)
                {
                    frame.moveDirection = (Vector3)(frame.moveDirection / magnitude);
                    magnitude          *= magnitude;
                    frame.moveDirection = (Vector3)(frame.moveDirection * magnitude);
                }
                else if (magnitude > 1f)
                {
                    frame.moveDirection = (Vector3)(frame.moveDirection / magnitude);
                }
                if (InputSample.MovementScale < 1f)
                {
                    if (InputSample.MovementScale > 0f)
                    {
                        frame.moveDirection = (Vector3)(frame.moveDirection * InputSample.MovementScale);
                    }
                    else
                    {
                        frame.moveDirection = Vector3.zero;
                    }
                }
                Vector3 moveDirection = frame.moveDirection;
                moveDirection.x *= this.controlConfig.sprintScaleX;
                moveDirection.z *= this.controlConfig.sprintScaleY;
                if ((sample.sprint && !flag3) && !sample.aim)
                {
                    num2 = Time.deltaTime * this.sprintInMulTime;
                }
                else
                {
                    sample.sprint = false;
                    num2          = -Time.deltaTime;
                }
                frame.moveDirection += (Vector3)(moveDirection * this.controlConfig.curveSprintAddSpeedByTime.EvaluateClampedTime(ref this.sprintTime, num2));
                if (flag3)
                {
                    num3 = Time.deltaTime * this.crouchInMulTime;
                }
                else
                {
                    num3 = -Time.deltaTime;
                }
                frame.moveDirection = (Vector3)(frame.moveDirection * this.controlConfig.curveCrouchMulSpeedByTime.EvaluateClampedTime(ref this.crouchTime, num3));
                frame.moveDirection = base.transform.TransformDirection(frame.moveDirection);
                if (this.wasInAir)
                {
                    float a = frame.moveDirection.magnitude;
                    if (!Mathf.Approximately(a, this.magnitudeAir))
                    {
                        frame.moveDirection = (Vector3)(frame.moveDirection / a);
                        frame.moveDirection = (Vector3)(frame.moveDirection * this.magnitudeAir);
                    }
                }
                else
                {
                    frame.moveDirection = (Vector3)(frame.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 (DebugInput.GetKey(KeyCode.H))
            {
                frame.moveDirection = (Vector3)(frame.moveDirection * 100f);
            }
            ccmotor.input = frame;
            if (ccmotor.stepMode == CCMotor.StepMode.Elsewhere)
            {
                ccmotor.Step();
            }
        }
        else
        {
            isSliding  = false;
            isGrounded = true;
        }
        Character  idMain     = base.idMain;
        Crouchable crouchable = idMain.crouchable;

        if (idMain != null)
        {
            Angle2 eyesAngles = base.eyesAngles;
            eyesAngles.yaw   = Mathf.DeltaAngle(0f, base.eyesAngles.yaw + sample.yaw);
            eyesAngles.pitch = base.ClampPitch((float)(eyesAngles.pitch + sample.pitch));
            base.eyesAngles  = eyesAngles;
            ushort flags = idMain.stateFlags.flags;
            if (crouchable != null)
            {
                this.crouch_smoothing.AddSeconds((double)Time.deltaTime);
                crouchable.LocalPlayerUpdateCrouchState(ccmotor, ref sample.crouch, ref sample.info__crouchBlocked, ref this.crouch_smoothing);
            }
            int num6 = ((((((((((((!sample.aim ? 0 : 4) | (!sample.sprint ? 0 : 2)) | (!sample.attack ? 0 : 8)) | (!sample.attack2 ? 0 : 0x100)) | (!sample.crouch ? 0 : 1)) | (((sample.strafe == 0f) && (sample.walk == 0f)) ? 0 : 0x40)) | (!LockCursorManager.IsLocked() ? 0x80 : 0)) | (!isGrounded ? 0x10 : 0)) | (!isSliding ? 0 : 0x20)) | (!this.bleeding ? 0 : 0x200)) | (!sample.lamp ? 0 : 0x800)) | (!sample.laser ? 0 : 0x1000)) | (!sample.info__crouchBlocked ? 0 : 0x400);
            idMain.stateFlags = num6;
            if (flags != num6)
            {
                idMain.Signal_State_FlagsChanged(false);
            }
        }
        this.crouch_was_blocked = sample.info__crouchBlocked;
        if (sample.inventory)
        {
            RPOS.Toggle();
        }
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            RPOS.Hide();
        }
    }
 /// <summary>
 ///   Called when the inspector gets active.
 /// </summary>
 public void OnEnable()
 {
     this.instance = this.target as DebugInput;
     this.propertyFields = this.instance != null ? ExposeProperties.GetProperties(this.instance) : null;
 }