예제 #1
0
 private void DrawMapIcons()
 {
     if (!UI || !UI.gameObject)
     {
         return;
     }
     if (!Camera.orthographic)
     {
         Camera.orthographic = true;
     }
     if (!Camera.CompareTag("MapCamera"))
     {
         Camera.tag = "MapCamera";
     }
     if (Camera.cullingMask != mapRenderMask)
     {
         Camera.cullingMask = mapRenderMask;
     }
     foreach (var iconKvp in iconsWithHolder)
     {
         MapIconHolder holder      = iconKvp.Key;
         float         sqrDistance = Vector3.SqrMagnitude(holder.transform.position - player.position);
         if (iconKvp.Key.isActiveAndEnabled && !iconKvp.Value.ForceHided && (isViewingWorldMap && holder.drawOnWorldMap || !isViewingWorldMap && (!holder.AutoHide ||
                                                                                                                                                  holder.AutoHide && holder.DistanceSqr >= sqrDistance)))
         {
             if (holder.showRange && !iconKvp.Value.iconRange)
             {
                 iconKvp.Value.iconRange = ObjectPool.Get(UI.rangePrefab.gameObject, UI.rangesParent).GetComponent <MapIconRange>();
             }
             holder.ShowIcon(CameraZoom);
             DrawMapIcon(holder.transform.position + new Vector3(holder.offset.x, use2D ? holder.offset.y : 0, use2D ? 0 : holder.offset.y), iconKvp.Value, holder.keepOnMap);
             if (!IsViewingWorldMap && sqrDistance > holder.DistanceSqr * 0.81f && sqrDistance < holder.DistanceSqr)
             {
                 iconKvp.Value.ImageCanvas.alpha = (holder.DistanceSqr - sqrDistance) / (holder.DistanceSqr * 0.19f);
             }
             else
             {
                 iconKvp.Value.ImageCanvas.alpha = 1;
             }
         }
         else
         {
             holder.HideIcon();
         }
     }
     foreach (var icon in IconsWithoutHolder.Values)
     {
         DrawMapIcon(icon.worldPosition, icon.mapIcon, icon.keepOnMap);
     }
 }
예제 #2
0
 private void DrawMapIcons()
 {
     if (!UI || !UI.gameObject)
     {
         return;
     }
     if (!MapCamera.orthographic)
     {
         MapCamera.orthographic = true;
     }
     if (MapCamera.cullingMask != mapRenderMask)
     {
         MapCamera.cullingMask = mapRenderMask;
     }
     foreach (var iconKvp in iconsWithHolder)
     {
         MapIconHolder holder   = iconKvp.Key;
         float         distance = Vector3.Magnitude(holder.transform.position - player.position);
         if (iconKvp.Key.isActiveAndEnabled && !iconKvp.Value.ForceHided && (isViewingWorldMap && holder.drawOnWorldMap || !isViewingWorldMap && (!holder.AutoHide ||
                                                                                                                                                  holder.AutoHide && holder.maxValidDistance >= distance)))
         {
             holder.ShowIcon(CameraZoom);
             DrawMapIcon(holder.transform.position + new Vector3(holder.offset.x, use2D ? holder.offset.y : 0, use2D ? 0 : holder.offset.y), iconKvp.Value, holder.keepOnMap);
             if (!IsViewingWorldMap && distance > holder.maxValidDistance * 0.9f && distance < holder.maxValidDistance)
             {
                 iconKvp.Value.ImageCanvas.alpha = (holder.maxValidDistance - distance) / (holder.maxValidDistance * 0.1f);
             }
             else
             {
                 iconKvp.Value.ImageCanvas.alpha = 1;
             }
         }
         else
         {
             holder.HideIcon();
         }
     }
     foreach (var icon in NormalIcons)
     {
         DrawMapIcon(icon.Position, icon, icon.KeepOnMap);
     }
 }