コード例 #1
0
        /// <summary>
        /// Tries to create the tileGO associated to the provided info.
        /// </summary>
        /// <returns>The created tileGO component (TileBehaviour if the tileGO has a TileBehaviour, Transform of the tileGO if not)</returns>
        /// <param name="info">The tile type.</param>
        /// <param name="x">The x tile coordinate.</param>
        /// <param name="y">The y tile coordinate.</param>
        /// <param name="callback">The callback that is called for every affected tile (tiles covered by the new tileGO).</param>
        public Component TryCreateTileGO(TileInfo info, int x, int y, PositionCallback callback)
        {
            if (info.tileGO != null)
            {
                TileBehaviour behaviour = info.tileGO.GetComponent <TileBehaviour> ();

                if (behaviour == null)
                {
                    if (componentGrid.Get(x, y) != null)
                    {
                        return(null);
                    }
                }
                else
                {
                    if (HasOverlap(x, y, behaviour))
                    {
                        return(null);
                    }
                }

                return(_CreateTileGO(info.tileGO, x, y, callback));
            }

            return(null);
        }
コード例 #2
0
ファイル: TrackerCallback.cs プロジェクト: geary/OSVR-Unity
        public static void Main(string[] args)
        {
            OSVR.ClientKit.ClientContext context = new OSVR.ClientKit.ClientContext("org.opengoggles.exampleclients.managed.TrackerCallback");

            // This is just one of the paths. You can also use:
            // /me/hands/right
            // /me/head
            Interface lefthand = context.getInterface("/me/hands/left");

            TrackerCallbacks callbacks = new TrackerCallbacks();

            // The coordinate system is right-handed, withX to the right, Y up, and Z near.
            OSVR.ClientKit.PoseCallback poseCb = new PoseCallback(TrackerCallbacks.myTrackerCallback);
            lefthand.registerCallback(poseCb, IntPtr.Zero);

            // If you just want orientation
            OSVR.ClientKit.OrientationCallback oriCb = new OrientationCallback(TrackerCallbacks.myOrientationCallback);
            lefthand.registerCallback(oriCb, IntPtr.Zero);

            // or position
            OSVR.ClientKit.PositionCallback posCb = new PositionCallback(TrackerCallbacks.myPositionCallback);
            lefthand.registerCallback(posCb, IntPtr.Zero);

            // Pretend that this is your application's main loop
            for (int i = 0; i < 1000000; ++i)
            {
                context.update();
            }

            Console.WriteLine("Library shut down; exiting.");
        }
コード例 #3
0
 public void RegisterCallback(PositionCallback callback)
 {
     Start(); // make sure the interface is initialized.
     if (null == positionCallbacks)
     {
         positionCallbacks   = callback;
         rawPositionCallback = new OSVR.ClientKit.PositionCallback(PositionCb);
         iface.registerCallback(rawPositionCallback, System.IntPtr.Zero);
     }
     else
     {
         positionCallbacks += callback;
     }
 }
コード例 #4
0
        Component _CreateTileGO(GameObject prefab, int x, int y, PositionCallback callback)
        {
            GameObject tile = Object.Instantiate(prefab);

            tile.transform.SetParent(container.transform);
            tile.transform.localPosition = new Vector2(x + 0.5f, y + 0.5f);

            TileBehaviour tileBehaviour = tile.GetComponent <TileBehaviour> ();

            if (tileBehaviour != null)
            {
                tileBehaviour._x = x;
                tileBehaviour._y = y;

                x += tileBehaviour.areaBottomLeftXOffset;
                y += tileBehaviour.areaBottomLeftYOffset;

                bool[,] area = tileBehaviour.area;

                for (int i = 0; i < area.GetLength(0); i++)
                {
                    for (int j = 0; j < area.GetLength(1); j++)
                    {
                        if (area [i, j])
                        {
                            componentGrid.Set(x + i, y + j, tileBehaviour);

                            callback(x + i, y + j);
                        }
                    }
                }

                componentGrid.Set(
                    tileBehaviour._x,
                    tileBehaviour._y,
                    tileBehaviour
                    );

                return(tileBehaviour);
            }
            else
            {
                componentGrid.Set(x, y, tile.transform);

                return(tile.transform);
            }
        }
コード例 #5
0
        /// <summary>
        /// Removes and destroys the tileGO at the given location.
        /// </summary>
        /// <returns>The component of the tileGO (TileBehaviour or Transform, first found)</returns>
        /// <param name="x">The x tile coordinate.</param>
        /// <param name="y">The y tile coordinate.</param>
        /// <param name="callback">The callback that is called for every affected tile (tiles covered by the new tileGO).</param>
        public Component DestroyTileGO(int x, int y, PositionCallback callback)
        {
            Component component = componentGrid.Get(x, y);

            if (component != null)
            {
                if (component is TileBehaviour)
                {
                    x = (component as TileBehaviour)._x + (component as TileBehaviour).areaBottomLeftXOffset;
                    y = (component as TileBehaviour)._y + (component as TileBehaviour).areaBottomLeftYOffset;

                    bool[,] area = (component as TileBehaviour).area;

                    for (int i = 0; i < area.GetLength(0); i++)
                    {
                        for (int j = 0; j < area.GetLength(1); j++)
                        {
                            if (area [i, j])
                            {
                                componentGrid.Set(x + i, y + j, null);

                                callback(x + i, y + j);
                            }
                        }
                    }
                    componentGrid.Set((component as TileBehaviour)._x, (component as TileBehaviour)._y, null);
                }
                else
                {
                    componentGrid.Set(x, y, null);
                }

                if (Application.isPlaying)
                {
                    Object.Destroy(component.gameObject);
                }
                else
                {
                    Object.DestroyImmediate(component.gameObject);
                }

                return(component);
            }
            return(null);
        }
コード例 #6
0
 public int WatchPosition(PositionCallback successCallback)
 {
     return 0;
 }
コード例 #7
0
 public Target(PositionCallback cb)
 {
     m_positionCallback = cb;
     m_transform        = null;
     m_position         = Vector3.zero;
 }
コード例 #8
0
 public long WatchPosition(PositionCallback successCallback, PositionErrorCallback errorCallback, PositionOptions options)
 {
     return(default(long));
 }
コード例 #9
0
ファイル: Geolocation.cs プロジェクト: fjgandrade/sharpkit
	public  int watchPosition(PositionCallback successCallback) { return default(int); }
コード例 #10
0
ファイル: Geolocation.cs プロジェクト: fjgandrade/sharpkit
	public  void getCurrentPosition(PositionCallback successCallback) {}
コード例 #11
0
ファイル: Geolocation.cs プロジェクト: fjgandrade/sharpkit
 public void GetCurrentPosition(PositionCallback successCallback, PositionErrorCallback errorCallback, PositionOptions options) { }
コード例 #12
0
 public void RegisterCallback(PositionCallback callback)
 {
     Start(); // make sure the interface is initialized.
     if (null == positionCallbacks)
     {
         positionCallbacks = callback;
         rawPositionCallback = new OSVR.ClientKit.PositionCallback(PositionCb);
         iface.registerCallback(rawPositionCallback, System.IntPtr.Zero);
     }
     else
     {
         positionCallbacks += callback;
     }
 }
コード例 #13
0
 public int WatchPosition(PositionCallback successCallback, PositionErrorCallback errorCallback, PositionOptions options)
 {
     return 0;
 }
コード例 #14
0
ファイル: Interface.cs プロジェクト: ReliaSolve/Managed-OSVR
 public void registerCallback(PositionCallback cb, IntPtr /*void*/ userdata)
 {
     osvrRegisterPositionCallback(m_interface, cb, userdata);
 }
コード例 #15
0
ファイル: appmobi-4.0.0.cs プロジェクト: fjgandrade/sharpkit
 /// <summary>
 /// Use this command to get the current location of the device.
 /// </summary>
 /// <remarks>
 /// Use this command to get the current location. This command asynchronously acquires the approximate latitude and longitude of the device. When data is available, the success function is called. If there is an error getting position data, the error function is called.
 /// <para>Available Platforms:</para>
 /// <list type="bullet">
 /// <item>
 /// <description>Apple iOS</description>
 /// </item>
 /// <item>
 /// <description>Google Android</description>
 /// </item>
 /// <item>
 /// <description>Microsoft Windows 8</description>
 /// </item>
 /// <item>
 /// <description>Microsoft Windows Phone 8</description>
 /// </item>
 /// <item>
 /// <description>Html5 natively</description>
 /// </item>
 /// <item>
 /// <description>XDK emulated mode</description>
 /// </item>
 /// </list>
 /// </remarks>
 /// <example>
 /// <code lang="C#">
 /// // Tips: if your class inherit from the "HtmlContext" base class, you don't need to add "HtmlContext." before "undefined" or "alert"
 /// public static void GetLocation()
 /// {
 ///     PositionCallback Suc = delegate(Geoposition p)
 ///     {
 ///         HtmlContext.alert("geolocation success");
 ///         if (p.coords.latitude as object != HtmlContext.undefined)
 ///         {
 ///             var currentLatitude = p.coords.latitude;
 ///             var currentLongitude = p.coords.longitude;
 ///         }
 ///     };
 ///     PositionErrorCallback Fail = delegate(PositionError p)
 ///     {
 ///         HtmlContext.alert("geolocation failed");
 ///         GetLocation();
 ///     };
 ///     AppMobi.geolocation.getCurrentPosition(Suc, Fail);
 /// }
 /// </code>
 /// </example>
 /// <param name="successCallback">When data is available, this success function is called.</param>
 /// <param name="errorCallback">If there is an error getting position data, the error function is called.</param>
 public new void getCurrentPosition(PositionCallback successCallback, PositionErrorCallback errorCallback) { }
コード例 #16
0
 public int WatchPosition(PositionCallback successCallback, PositionErrorCallback errorCallback, PositionOptions options)
 {
     return(0);
 }
コード例 #17
0
 public int WatchPosition(PositionCallback successCallback)
 {
     return(0);
 }
コード例 #18
0
 public void GetCurrentPosition(PositionCallback successCallback, PositionErrorCallback errorCallback)
 {
 }
コード例 #19
0
 protected override void Start()
 {
     cb = new PositionCallback(this.InterfaceCallback);
     Interface.osvrRegisterPositionCallback(iface.Handle, cb, IntPtr.Zero);
 }
コード例 #20
0
ファイル: appmobi-4.0.0.cs プロジェクト: fjgandrade/sharpkit
 /// <summary>
 /// Use this command rather than the getCurrentPosition command to track progress during a trip rather than just getting a single position.
 /// </summary>
 /// <remarks>
 /// Use this command rather than the <see cref="getCurrentPosition(PositionCallback,PositionErrorCallback)">getCurrentPosition</see> command to track progress during a trip rather than just getting a single position. This command asynchronously acquires the latitude and longitude of the device. When data is available, the success function is called. If there is an error getting position data, the error function is called.
 /// <para>Available Platforms:</para>
 /// <list type="bullet">
 /// <item>
 /// <description>Apple iOS</description>
 /// </item>
 /// <item>
 /// <description>Google Android</description>
 /// </item>
 /// <item>
 /// <description>Microsoft Windows 8</description>
 /// </item>
 /// <item>
 /// <description>Microsoft Windows Phone 8</description>
 /// </item>
 /// <item>
 /// <description>Html5 natively</description>
 /// </item>
 /// <item>
 /// <description>XDK emulated mode</description>
 /// </item>
 /// </list>
 /// </remarks>
 /// <example>
 /// <code lang="C#">
 /// // Tips: if your class inherit from the "HtmlContext" base class, you don't need to add "HtmlContext." before "alert"
 /// // This object holds the options for the command
 /// var options = new PositionOptions() { timeout = 10000, maximumAge = 11000, enableHighAccuracy = true };
 /// // This function is called on every iteration of the watch Position command that fails
 /// PositionErrorCallback Fail = delegate(PositionError p)
 /// {
 ///     HtmlContext.alert("Geolocation failed. \nPlease enable GPS in Settings.");
 /// };
 /// // This function is called on every iteration of the watchPosition command that is a success
 /// PositionCallback Suc = delegate(Geoposition p)
 /// {
 ///     HtmlContext.alert("Moved To: Latitude:" + p.coords.latitude + "Longitude:" + p.coords.longitude);
 /// };
 /// // This command starts watching the geolocation
 /// int geolocationWatchTimer = AppMobi.geolocation.watchPosition(Suc, Fail, options);
 /// // Call the StopGeolocation function to stop the geolocation watch
 /// JsAction StopGeolocation = delegate()
 /// {
 ///     AppMobi.geolocation.clearWatch(geolocationWatchTimer);
 /// };
 /// </code>
 /// </example>
 /// <param name="successCallback">When data is available, this success function is called.</param>
 /// <param name="errorCallback">If there is an error getting position data, the error function is called.</param>
 /// <returns>geolocationWatchTimer</returns>
 public new int watchPosition(PositionCallback successCallback, PositionErrorCallback errorCallback) { return default(int); }
コード例 #21
0
 public Move(Mob mob, PositionCallback callback, float timeout = 0f) : base(timeout) =>
     (this.mob, this.get_position) = (mob, callback);
コード例 #22
0
ファイル: Interface.cs プロジェクト: ReliaSolve/Managed-OSVR
 public extern static Byte osvrRegisterPositionCallback(SafeClientInterfaceHandle iface, [MarshalAs(UnmanagedType.FunctionPtr)] PositionCallback cb, IntPtr /*void**/ userdata);
コード例 #23
0
 // Geolocation
 public void getCurrentPosition(PositionCallback successCallback)
 {
 }
コード例 #24
0
 public void getCurrentPosition(PositionCallback successCallback, PositionErrorCallback errorCallback, PositionOptions options)
 {
 }
コード例 #25
0
 public int watchPosition(PositionCallback successCallback)
 {
     return(default(int));
 }
コード例 #26
0
ファイル: Geolocation.cs プロジェクト: fjgandrade/sharpkit
 public long WatchPosition(PositionCallback successCallback, PositionErrorCallback errorCallback, PositionOptions options) { return default(long); }
コード例 #27
0
 public int watchPosition(PositionCallback successCallback, PositionErrorCallback errorCallback, PositionOptions options)
 {
     return(default(int));
 }
コード例 #28
0
ファイル: Geolocation.cs プロジェクト: fjgandrade/sharpkit
 public long WatchPosition(PositionCallback successCallback) { return default(long); }
コード例 #29
0
ファイル: Tween.cs プロジェクト: lambertjamesd/douglas-game
 public static IEnumerator LerpPosition(Vector3 start, Vector3 end, float duration, PositionCallback callback)
 {
     return(Tween(duration, (t) =>
     {
         callback(Vector3.Lerp(start, end, t));
     }));
 }
コード例 #30
0
ファイル: Geolocation.cs プロジェクト: fjgandrade/sharpkit
	public  void getCurrentPosition(PositionCallback successCallback, PositionErrorCallback errorCallback, object options) {}
コード例 #31
0
ファイル: Interface.cs プロジェクト: iscoder/Managed-OSVR
 public void registerCallback(PositionCallback cb, IntPtr /*void*/ userdata)
 {
     osvrRegisterPositionCallback(m_interface, cb, userdata);
 }
コード例 #32
0
ファイル: Geolocation.cs プロジェクト: fjgandrade/sharpkit
	public  int watchPosition(PositionCallback successCallback, PositionErrorCallback errorCallback, object options) { return default(int); }
コード例 #33
0
 public long WatchPosition(PositionCallback successCallback)
 {
     return(default(long));
 }