public void OnStateChange(ShuttleConsoleState newState)
 {
     if (newState == ShuttleConsoleState.Off)
     {
         SetSafetyProtocols(true);
         UpdateManager.Remove(CallbackType.PERIODIC_UPDATE, UpdateMe);
         ClearScreen();
         return;
     }
     if (newState == ShuttleConsoleState.Normal)
     {
         AddRadarItems();
         //Important: set values from server using SetValue and not Value
         Rulers.SetValueServer(rulersColor);
         RadarScanRay.SetValueServer(rayColor);
         Crosshair.SetValueServer(crosshairColor);
         SetSafetyProtocols(true);
     }
     else if (newState == ShuttleConsoleState.Emagged)
     {
         AddRadarItems(true);
         //Repaint radar to evil colours
         Rulers.SetValueServer(HSVUtil.ChangeColorHue(rulersColor, -80));
         RadarScanRay.SetValueServer(HSVUtil.ChangeColorHue(rayColor, -80));
         Crosshair.SetValueServer(HSVUtil.ChangeColorHue(crosshairColor, -80));
         SetSafetyProtocols(false);
     }
     UpdateManager.Add(UpdateMe, 1f);
     OffOverlay.SetValueServer(Color.clear);
 }
예제 #2
0
        private void OnStateChange(TabState newState)
        {
            //Important: if you get NREs out of nowhere, make sure your server code doesn't accidentally run on client as well
            if (!IsServer)
            {
                return;
            }

            switch (newState)
            {
            case TabState.Normal:
                PowerOff();
                StartNormalOperation();
                //Important: set values from server using SetValue and not Value
                OffOverlay.SetValueServer(Color.clear);
                Rulers.SetValueServer(rulersColor);
                RadarScanRay.SetValueServer(rayColor);
                Crosshair.SetValueServer(crosshairColor);
                SetSafetyProtocols(true);

                break;

            case TabState.Emagged:
                PowerOff();
                StartNormalOperation();
                //Remove overlay
                OffOverlay.SetValueServer(Color.clear);
                //Repaint radar to evil colours
                Rulers.SetValueServer(HSVUtil.ChangeColorHue(rulersColor, -80));
                RadarScanRay.SetValueServer(HSVUtil.ChangeColorHue(rayColor, -80));
                Crosshair.SetValueServer(HSVUtil.ChangeColorHue(crosshairColor, -80));
                AddEmagItems();
                SetSafetyProtocols(false);

                break;

            case TabState.Off:
                PowerOff();
                //Black screen overlay
                OffOverlay.SetValueServer(Color.black);
                SetSafetyProtocols(true);

                break;

            default:
                return;
            }
        }
예제 #3
0
 private static string ChangeColorHue(string srcHexColour, int amount)
 {
     return(DebugTools.ColorToHex(HSVUtil.ChangeColorHue(DebugTools.HexToColor(srcHexColour), amount)));
 }