public void Update()
        {
            if (material && material.mainTexture != particleTexture)
            {
                material.mainTexture = particleTexture;
            }

            var pos          = GM.LatLonToMeters(latLon) - positioner.Tile.Rect.Center;
            var basePosition = new Vector3((float)pos.x, 10, (float)pos.y);
            var centerVector = new Vector3(0, 0, transform.localScale.y / 2f);

            transform.localPosition = basePosition + centerVector;
            transform.localRotation = Quaternion.Euler(90, rotation, 0);

            if (interactionRange <= 0 || GM.SeparationInMeters(character.LatLon, latLon) <= interactionRange)
            {
                SetShown(true);
                if (interactuable != null)
                {
                    interactuable.setInteractuable(true);
                }
            }
            else if (shown)
            {
                SetShown(false);
                if (interactuable != null)
                {
                    interactuable.setInteractuable(true);
                }
            }
        }
Beispiel #2
0
        public void Update()
        {
            if (material && material.mainTexture != particleTexture)
            {
                material.mainTexture = particleTexture;
            }

            var pos          = GM.LatLonToMeters(latLon) - positioner.Tile.Rect.Center;
            var basePosition = new Vector3((float)pos.x, 10, (float)pos.y);
            var centerVector = new Vector3(0, 0, transform.localScale.y / 2f);

            transform.localPosition = basePosition + centerVector;
            transform.localRotation = Quaternion.Euler(90, rotation, 0);

            if (interactionRange <= 0 || GM.SeparationInMeters(GeoExtension.Instance.Location, latLon) <= interactionRange)
            {
                SetShown(true);
                if (interactuable != null)
                {
                    interactuable.setInteractuable(true);
                }
            }
            else if (shown)
            {
                SetShown(false);
                if (interactuable != null)
                {
                    interactuable.setInteractuable(true);
                }
            }

            if (geoActionManagers == null && Context != null && Context.Actions != null)
            {
                geoActionManagers = new List <IGeoActionManager>();
                foreach (var action in Context.Actions)
                {
                    GeoActionManagerFactory.Instance.CreateFor(action);
                    var newManager = GeoActionManagerFactory.Instance.CreateFor(action);
                    newManager.Element  = Context.TargetId;
                    newManager.Geometry = new GMLGeometry
                    {
                        Influence = interactionRange,
                        Points    = new Vector2d[] { latLon },
                        Type      = GMLGeometry.GeometryType.Point
                    };
                    newManager.Player = character;
                    newManager.Holder = positioner.gameObject;
                    geoActionManagers.Add(newManager);
                }
            }

            if (geoActionManagers != null)
            {
                geoActionManagers.ForEach(g => g.Update());
            }
        }
    void Update()
    {
        if (checkingTransparency)
        {
            RaycastHit hit;
            Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit);

            if (((Texture2D)GetComponent <Renderer> ().material.mainTexture).GetPixelBilinear(hit.textureCoord.x, hit.textureCoord.y).a > 0f)
            {
                interactuable.setInteractuable(true);
                GUIManager.Instance.showHand(true);
            }
            else
            {
                interactuable.setInteractuable(false);
                GUIManager.Instance.showHand(false);
            }
        }
    }
Beispiel #4
0
 public void OnPointerEnter(PointerEventData eventData)
 {
     GUIManager.Instance.ShowHand(true);
     interactuable.setInteractuable(true);
 }