Esempio n. 1
0
        public override AnnotationGameObject GetObjectForAnnotation(MapAnnotation <LocationTaskDriver> annotation)
        {
            AnnotationGameObject annotationObj = null;

            if (annotation.Data.Task.MarkerAssetInstance != null)
            {
                annotationObj = MapController.Instance.Create3DAssetAnnotation(annotation.Data.Task.MarkerAssetInstance);
            }
            else if (annotation.Data.Task.Marker != null)
            {
                annotationObj = MapMarkerAnnotationHandler.Instance.CreateMarkerAnnotation(annotation.Data.Task.Marker);
            }
            else if (UseTaskImageForAnnotation && annotation.Data.Task.ImageUrl != null)
            {
                var imgAnnot = Instantiate <CustomImageAnnotation>(MapMarkerAnnotationHandler.Instance.CustomImageAnnotation);

                annotationObj = imgAnnot;

                annotationObj.gameObject.SetActive(false);

                StartCoroutine(ImageLoader.LoadImage(annotation.Data.Task.ImageUrl, imgAnnot.gameObject, true, () =>
                {
                    annotationObj.gameObject.SetActive(true);
                }));
            }
            else
            {
                annotationObj = Instantiate <AnnotationGameObject>(GetPrefabForAnnotation(annotation));
            }

            base.ConfigureAnnotationObject(annotation, annotationObj);

            return(annotationObj);
        }
Esempio n. 2
0
        protected virtual void ConfigureAnnotationObjectRange(T annotation, AnnotationGameObject obj)
        {
            obj.RangeDisplayMode = RangeDisplayMode;

            switch (RangeDisplayMode)
            {
            case AnnotationRangeDisplayMode.Always:
            case AnnotationRangeDisplayMode.WhenSelected:
                obj.Range = Range;
                break;
            }
        }
Esempio n. 3
0
        /*
         * public virtual AnnotationGameObject GetSearchAnnotationObject(MapView sender, IAnnotation annotation)
         * {
         *  return Instantiate<AnnotationGameObject>(DefaultAnnotation);
         * }*/

        public virtual GameObject GetObjectForAnnotation(MapView sender, IAnnotation annotation)
        {
            if (annotation is UserAnnotation)
            {
                return(GetUserAnnotationObject(sender, annotation).gameObject);
            }

            AnnotationGameObject annotationObj = null;

            var mapAnnotation = annotation as MapAnnotation;

            if (mapAnnotation.Delegate != null)
            {
                annotationObj = mapAnnotation.Delegate.GetObjectForAnnotation(mapAnnotation);
            }

            /*
             * else
             * {
             *  if (mapAnnotation.Marker != null)
             *  {
             *      annotationObj = CreateMarkerAnnotation(mapAnnotation.Marker);
             *  }
             *  else if (mapAnnotation.AssetInstance != null)
             *  {
             *      annotationObj = Create3DAssetAnnotation(mapAnnotation.AssetInstance);
             *  }
             *  else if (m_searchLocations.ContainsKey(mapAnnotation.Location.Id))
             *  {
             *      annotationObj = GetSearchAnnotationObject(sender, mapAnnotation);
             *  }
             *  else
             *  {
             *      annotationObj = GetDefaultAnnotationObject(sender, mapAnnotation);
             *  }
             * }
             */

            if (annotationObj != null)
            {
                annotationObj.Annotation = mapAnnotation;
                return(annotationObj.gameObject);
            }

            return(null);
        }
Esempio n. 4
0
 protected virtual void ConfigureAnnotationObject(T annotaion, AnnotationGameObject obj)
 {
     ConfigureAnnotationObjectRange(annotaion, obj);
 }
Esempio n. 5
0
        protected override void ConfigureAnnotationObjectRange(MapAnnotation <LocationTaskDriver> annotation, AnnotationGameObject annotationObj)
        {
            if (annotationObj &&
                annotation.Data.Task.ActionRange != null)
            {
                annotationObj.RangeDisplayMode = AnnotationRangeDisplayMode.WhenSelected;

                var range = annotation.Data.Range;

                if (range != 0)
                {
                    if (range > 0)
                    {
                        // Normal range: you have to be "within" this range to
                        annotationObj.Range = (float)range;

                        annotationObj.InRangeColor    = RangeCircleColor;
                        annotationObj.OutOfRangeColor = OutOfRangeColor;
                    }
                    else if (annotation.Data.Task.ActionRange.Min.HasValue)
                    {
                        // Inverse range: you have to be outside of this range
                        annotationObj.Range = (float)-range;

                        annotationObj.InRangeColor    = InvertRangeCircleColor;
                        annotationObj.OutOfRangeColor = OutOfRangeColor;
                    }
                }
            }
        }
        /// <summary>
        /// Configures the annotation object. In this case looks for a task info component and populates
        /// it with annotation data.
        /// </summary>
        /// <param name="obj"></param>
        protected override void ConfigureAnnotationObject(MapAnnotation <D> annotation, AnnotationGameObject obj)
        {
            var infoComponent = obj.GetComponentInChildren <PlayerTaskInfoComponent>();

            if (infoComponent)
            {
                infoComponent.Populate(annotation.GetData());
            }

            base.ConfigureAnnotationObject(annotation, obj);
        }