Ejemplo n.º 1
0
 public void CopyFrom(ControllerState other)
 {
     connectionState  = other.connectionState;
     apiStatus        = other.apiStatus;
     orientation      = other.orientation;
     gyro             = other.gyro;
     accel            = other.accel;
     isTouching       = other.isTouching;
     touchPos         = other.touchPos;
     touchDown        = other.touchDown;
     touchUp          = other.touchUp;
     recentered       = other.recentered;
     clickButtonState = other.clickButtonState;
     clickButtonDown  = other.clickButtonDown;
     clickButtonUp    = other.clickButtonUp;
     appButtonState   = other.appButtonState;
     appButtonDown    = other.appButtonDown;
     appButtonUp      = other.appButtonUp;
     homeButtonDown   = other.homeButtonDown;
     homeButtonUp     = other.homeButtonUp;
     homeButtonState  = other.homeButtonState;
     errorDetails     = other.errorDetails;
     gvrPtr           = other.gvrPtr;
     isCharging       = other.isCharging;
     batteryLevel     = other.batteryLevel;
 }
Ejemplo n.º 2
0
 public void CopyFrom(ControllerState other)
 {
     connectionState = other.connectionState;
     apiStatus       = other.apiStatus;
     orientation     = other.orientation;
     position        = other.position;
     gyro            = other.gyro;
     accel           = other.accel;
     touchPos        = other.touchPos;
     recentered      = other.recentered;
     buttonsState    = other.buttonsState;
     buttonsDown     = other.buttonsDown;
     buttonsUp       = other.buttonsUp;
     errorDetails    = other.errorDetails;
     gvrPtr          = other.gvrPtr;
     isCharging      = other.isCharging;
     batteryLevel    = other.batteryLevel;
 }
    private void UpdateBatteryIndicator()
    {
        GvrControllerBatteryLevel level = displayState.batteryLevel;
        bool charging = displayState.batteryCharging;

        switch (level)
        {
        case GvrControllerBatteryLevel.Full:
            controllerShaderData.w = BATTERY_FULL;
            currentBatteryColor    = GVR_BATTERY_FULL_COLOR;
            break;

        case GvrControllerBatteryLevel.AlmostFull:
            controllerShaderData.w = BATTERY_ALMOST_FULL;
            currentBatteryColor    = GVR_BATTERY_FULL_COLOR;
            break;

        case GvrControllerBatteryLevel.Medium:
            controllerShaderData.w = BATTERY_MEDIUM;
            currentBatteryColor    = GVR_BATTERY_MED_COLOR;
            break;

        case GvrControllerBatteryLevel.Low:
            controllerShaderData.w = BATTERY_LOW;
            currentBatteryColor    = GVR_BATTERY_LOW_COLOR;
            break;

        case GvrControllerBatteryLevel.CriticalLow:
            controllerShaderData.w = BATTERY_CRITICAL;
            currentBatteryColor    = GVR_BATTERY_CRITICAL_COLOR;
            break;

        default:
            controllerShaderData.w = BATTERY_HIDDEN;
            currentBatteryColor.a  = 0;
            break;
        }

        if (charging)
        {
            controllerShaderData.w = -controllerShaderData.w;
            currentBatteryColor    = GVR_BATTERY_FULL_COLOR;
        }
    }