예제 #1
0
 public static HumanController.InputSample Poll(bool noLamp, bool noLaser)
 {
     HumanController.InputSample inputSample = new HumanController.InputSample();
     if (ConsoleWindow.IsVisible())
     {
         return(new HumanController.InputSample());
     }
     if (MainMenu.IsVisible())
     {
         return(new HumanController.InputSample());
     }
     if (ChatUI.IsVisible())
     {
         return(new HumanController.InputSample());
     }
     if (LockEntry.IsVisible())
     {
         return(new HumanController.InputSample());
     }
     if (LockCursorManager.IsLocked(true))
     {
         float single = Time.deltaTime;
         inputSample.info__crouchBlocked = false;
         inputSample.walk = 0f;
         if (GameInput.GetButton("Up").IsDown())
         {
             inputSample.walk = inputSample.walk + 1f;
         }
         if (GameInput.GetButton("Down").IsDown())
         {
             inputSample.walk = inputSample.walk - 1f;
         }
         inputSample.strafe = 0f;
         if (GameInput.GetButton("Right").IsDown())
         {
             inputSample.strafe = inputSample.strafe + 1f;
         }
         if (GameInput.GetButton("Left").IsDown())
         {
             inputSample.strafe = inputSample.strafe - 1f;
         }
         inputSample.yaw   = GameInput.mouseDeltaX + HumanController.InputSample.yawSensitivityJoy * Input.GetAxis("Yaw") * single;
         inputSample.pitch = GameInput.mouseDeltaY + HumanController.InputSample.pitchSensitivityJoy * Input.GetAxis("Pitch") * single;
         if (input.flipy)
         {
             inputSample.pitch = inputSample.pitch * -1f;
         }
         inputSample.jump      = GameInput.GetButton("Jump").IsDown();
         inputSample.crouch    = GameInput.GetButton("Duck").IsDown();
         inputSample.sprint    = GameInput.GetButton("Sprint").IsDown();
         inputSample.aim       = false;
         inputSample.attack    = GameInput.GetButton("Fire").IsDown();
         inputSample.attack2   = GameInput.GetButton("AltFire").IsDown();
         inputSample.reload    = GameInput.GetButton("Reload").IsDown();
         inputSample.inventory = GameInput.GetButton("Inventory").IsPressed();
         inputSample.lamp      = (!noLamp ? HumanController.InputSample.saved.GetLamp(GameInput.GetButton("Flashlight").IsPressed()) : HumanController.InputSample.saved.lamp);
         inputSample.laser     = (!noLaser ? HumanController.InputSample.saved.GetLaser(GameInput.GetButton("Laser").IsPressed()) : HumanController.InputSample.saved.laser);
     }
     else
     {
         inputSample = new HumanController.InputSample();
         if (!UIUnityEvents.shouldBlockButtonInput)
         {
             inputSample.inventory = GameInput.GetButton("Inventory").IsPressed();
         }
         inputSample.lamp  = HumanController.InputSample.saved.lamp;
         inputSample.laser = HumanController.InputSample.saved.laser;
     }
     if (GameInput.GetButton("Chat").IsPressed())
     {
         ChatUI.Open();
     }
     return(inputSample);
 }