private void CheckSequence()
 {
     if (!this.Sequence)
     {
         this.SetSequence(GeoHashHelper <AnimationSequence> .GetFromHash(base.transform.ToGeoHash(), Lookup.Auto));
     }
 }
Example #2
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);
        }
Example #3
0
        public static AnimationSequenceProxy GetProxyFor(Vector3 position)
        {
            AnimationSequenceProxy animationSequenceProxy;

            if (BoltNetwork.isRunning)
            {
                animationSequenceProxy = GeoHashHelper <AnimationSequenceProxy> .GetFromHash(GeoHash.ToGeoHash(position), Lookup.Auto);

                if (!animationSequenceProxy)
                {
                    if (BoltNetwork.isClient)
                    {
                        RequestAnimationSequenceProxy requestAnimationSequenceProxy = RequestAnimationSequenceProxy.Create(GlobalTargets.OnlyServer);
                        requestAnimationSequenceProxy.Position = position;
                        requestAnimationSequenceProxy.Send();
                    }
                    else
                    {
                        animationSequenceProxy = UnityEngine.Object.Instantiate <AnimationSequenceProxy>(Prefabs.Instance.AnimationSequenceProxy, position, Quaternion.identity);
                    }
                }
                else
                {
                    animationSequenceProxy.entity.Freeze(false);
                }
            }
            else
            {
                animationSequenceProxy = null;
            }
            return(animationSequenceProxy);
        }
Example #4
0
 private void OnDestroy()
 {
     GeoHashHelper <GeoHashUnique> .Unregister(this);
 }