예제 #1
0
    private void Update()
    {
        if (!calibrating)
        {
            // Map to [-1, 1] * [-1, 1].
            Quaternion localRotation = Quaternion.Inverse(centerCalibration) * Input.gyro.attitude;
            point.x = 2 * (localRotation.y - localLowerRightRotation.y) / (localUpperLeftRotation.y - localLowerRightRotation.y) - 1;
            point.y = 2 * (localRotation.x - localUpperLeftRotation.x) / (localLowerRightRotation.x - localUpperLeftRotation.x) - 1;
            LowPassFilter();
            point.x     = Mathf.Min(1, Mathf.Max(-1, point.x));
            point.y     = Mathf.Min(1, Mathf.Max(-1, point.y));
            lastPoint.x = point.x;
            lastPoint.y = point.y;

            // Update point position on the server.
            if (upperLeftCalibrationDone && lowerRightCalibrationDone && Network.connections.Length > 0)
            {
                RPCWrapper.RPC("UpdateTarget", RPCMode.Server, point);
            }
        }
    }
예제 #2
0
 public void OnButtonPressedAndroid()
 {
     RPCWrapper.RPC("OnButtonPressedWin", RPCMode.Server);
     PhaseLoader.Load();
 }
예제 #3
0
 public void ShootButtonPressed()
 {
     RPCWrapper.RPC("ShootButtonPressed", RPCMode.Server);
 }