Example #1
0
        public void Start()
        {
            GeoHashUnique fromHash = GeoHashHelper <GeoHashUnique> .GetFromHash(base.transform.ToGeoHash(), Lookup.ManualOnly);

            if (fromHash && fromHash != this)
            {
                if (!this._keepLatest)
                {
                    Debug.Log(string.Format("[GeoHash] Older: Switching \"{0}\" -> \"{1}\"", GeoHashUnique.GetFullPath(base.transform.gameObject), GeoHashUnique.GetFullPath(fromHash.gameObject)));
                    if (this._adoptParent)
                    {
                        this.AdoptParent(base.gameObject.transform, fromHash.transform);
                    }
                    UnityEngine.Object.Destroy(base.gameObject);
                    return;
                }
                Debug.Log(string.Format("[GeoHash] Latest: Switching \"{0}\" -> \"{1}\"", GeoHashUnique.GetFullPath(fromHash.gameObject), GeoHashUnique.GetFullPath(base.transform.gameObject)));
                if (this._adoptParent)
                {
                    this.AdoptParent(fromHash.transform, base.gameObject.transform);
                }
                UnityEngine.Object.Destroy(fromHash.gameObject);
            }
            else
            {
                Debug.Log(string.Format("[GeoHash] First: \"{0}\"", GeoHashUnique.GetFullPath(base.transform.gameObject)));
            }
            GeoHashHelper <GeoHashUnique> .Register(this);
        }