Ejemplo n.º 1
0
        void Awake()
        {
            ScapeLogging.Log(message: "OGeoAnchor::Awake " + this.gameObject.name);

            // this.gameObject.SetActive(false);

            GeoWorldRoot.GetInstance().RegisterGeoEvent(this.OriginEvent);

            WorldCoordinates = new Coordinates {
                longitude = Longitude, latitude = Latitude
            };
            WorldPos = GeoConversions.VectorFromCoordinates(WorldCoordinates);
        }
Ejemplo n.º 2
0
        void OriginEvent(Coordinates SceneOriginCoordinates)
        {
            Vector2 SceneOrigin = GeoConversions.VectorFromCoordinates(SceneOriginCoordinates);

            ScenePos = WorldPos - SceneOrigin;

            string name = this.gameObject.name;

            ScapeLogging.Log(message: "OriginEvent() " + name + " ScenePos = " + ScenePos.ToString());
            ScapeLogging.Log(message: "OriginEvent() " + name + " WorldCoords = " + GeoConversions.CoordinatesToString(WorldCoordinates));

            if (ScenePos.magnitude < MaxDistance)
            {
                needsUpdate = true;

                this.gameObject.SetActive(true);
            }
            else
            {
                ScapeLogging.Log(message: "OriginEvent() " + name + " beyond max distance (" + ScenePos.magnitude + ")");

                this.gameObject.SetActive(false);
            }
        }