Example #1
0
    void ChangeControlMode(ControlMode newControlMode)
    {
        if (controlMode == newControlMode)
        {
            return;
        }

        //*** Exit old control mode
        {
            if (controlMode == ControlMode.ThirdPerson)
            {
                TeleportViewToAvatar();
                transform.parent = originalParentXform;
                motionController.Activate();
            }
            else if (controlMode == ControlMode.StepTeleport)
            {
                motionController.Activate();
            }
        }

        controlMode = newControlMode;

        motionController.useCanvas = controlMode == ControlMode.CanvasTexture;

        switch (controlMode)
        {
        case ControlMode.Standard:
            ShowControlMenu(duration: 0.75f);
            break;

        case ControlMode.CanvasTexture:
            Singletons.guiManager.ShowMessage("Canvas mode:\n" +
                                              "Press G or Controller B to cycle through\n" +
                                              "different canvas textures.", duration: 5);
            break;

        case ControlMode.ThirdPerson:
            transform.parent = null;
            motionController.Deactivate();
            Singletons.guiManager.ShowMessage("Third Person Control:\n" +
                                              "Keep RMB or right shoulder button\n" +
                                              "pressed and move your avatar,\n" +
                                              "then release to teleport your view.", duration: 5);
            break;

        case ControlMode.StepTeleport:
            motionController.Deactivate();
            Singletons.guiManager.ShowMessage("Stepwise teleport mode:\n" +
                                              "Keep RMB or right shoulder button pressed and\n" +
                                              "look where you want to go. Then release.\n" +
                                              "7 or DpadDown: decrease step size\n" +
                                              "8 or DpadUp: increase step size\n" +
                                              "9 or DpadLeft: decrease step duration\n" +
                                              "0 or DpadRight: increase step duration\n", duration: 5);
            break;

        case ControlMode.Stroboscopic:
            Singletons.guiManager.ShowMessage("Stroboscopic:\n" +
                                              "7 or DpadDown: decrease ShownFrames\n" +
                                              "8 or DpadUp: increase ShownFrames\n" +
                                              "9 or DpadLeft: decrease HiddenFrames\n" +
                                              "0 or DpadRight: increase HiddenFrames\n", duration: 5);
            break;
        }

        motionController.useStrobing = controlMode == ControlMode.Stroboscopic;
    }