private void CheckKeyboard()
        {
            foreach (string code in monitoredKeys)
            {
                if (InputController.GetKeyDown(code))
                {
                    Command cmd = new Command("_sys_key");
                    cmd.ps.Add(code);
                    if (InputController.GetKey("FPS Adjustment Acceleration"))
                    {
                        cmd.pi.Add(10);
                    }
                    else
                    {
                        cmd.pi.Add(1);
                    }
                    CommandSender.Send(cmd);
                }
            }

            if (InputController.GetKeyDown("Render FPS -"))
            {
                skipRate++;
            }
            if (InputController.GetKeyDown("Render FPS +"))
            {
                if (skipRate > 1)
                {
                    skipRate--;
                }
            }

            if (InputController.GetKeyDown("Reset Scene"))
            {
                foreach (string name in groupNames)
                {
                    var group = GameObject.Find(name);
                    if (group)
                    {
                        GameObject.Destroy(group);
                    }
                }
                groupNames.Clear();
            }
        }
示例#2
0
 private void HandleKeyPress()
 {
     if (InputController.GetKey("Camera Latitude +"))
     {
         latitude = Mathf.Clamp(latitude + latitudeAdjustmentStep, -Mathf.PI / 2, Mathf.PI / 2);
     }
     if (InputController.GetKey("Camera Latitude -"))
     {
         latitude = Mathf.Clamp(latitude - latitudeAdjustmentStep, -Mathf.PI / 2, Mathf.PI / 2);
     }
     if (InputController.GetKey("Camera Longitude -"))
     {
         longitude -= longitudeAdjustmentStep;
         if (longitude < 0)
         {
             longitude += Mathf.PI * 2;
         }
         if (longitude > Mathf.PI * 2)
         {
             longitude -= Mathf.PI * 2;
         }
     }
     if (InputController.GetKey("Camera Longitude +"))
     {
         longitude += longitudeAdjustmentStep;
         if (longitude < 0)
         {
             longitude += Mathf.PI * 2;
         }
         if (longitude > Mathf.PI * 2)
         {
             longitude -= Mathf.PI * 2;
         }
     }
     if (InputController.GetKey("Camera Radius +"))
     {
         sphereRadius += radiusAdjustmentStep;
     }
     if (InputController.GetKey("Camera Radius -"))
     {
         sphereRadius -= radiusAdjustmentStep;
     }
     if (InputController.GetKey("Camera Center Downward"))
     {
         sphereCenterOffset.y -= offsetAdjustmentStep;
     }
     if (InputController.GetKey("Camera Center Upward"))
     {
         sphereCenterOffset.y += offsetAdjustmentStep;
     }
     if (InputController.GetKey("Camera Center Forward"))
     {
         sphereCenterOffset += new Vector3(transform.forward.x, 0, transform.forward.z).normalized *offsetAdjustmentStep;
     }
     if (InputController.GetKey("Camera Center Backward"))
     {
         sphereCenterOffset -= new Vector3(transform.forward.x, 0, transform.forward.z).normalized *offsetAdjustmentStep;
     }
     if (InputController.GetKey("Camera Center Leftward"))
     {
         sphereCenterOffset -= new Vector3(transform.right.x, 0, transform.right.z).normalized *offsetAdjustmentStep;
     }
     if (InputController.GetKey("Camera Center Rightward"))
     {
         sphereCenterOffset += new Vector3(transform.right.x, 0, transform.right.z).normalized *offsetAdjustmentStep;
     }
 }