Пример #1
0
 public void SetSubType(int subtype)
 {
     if (this._subtype != subtype)
     {
         if (this.ID == 0)
         {
             this.ID = OverlayIconManager.GetNewId();
             Vector3 worldPosition = (!this.target) ? ((!base.transform.parent) ? base.transform.position : base.transform.parent.position) : this.target.position;
             float   num           = Terrain.activeTerrain.SampleHeight(worldPosition) + Terrain.activeTerrain.transform.position.y - 3f;
             this.IsInCaves = (worldPosition.y < num);
         }
         OverlayIconManager.Unregister(this);
         this._subtype = subtype;
         OverlayIconManager.Register(this);
     }
 }
Пример #2
0
 public static void Register(OverlayIcon oi)
 {
     if (!CoopPeerStarter.DedicatedHost)
     {
         if (OverlayIconManager.Instance)
         {
             if (!oi.GetComponentInParent <Rigidbody>())
             {
                 if (oi.ID == 0)
                 {
                     oi.ID = OverlayIconManager.GetNewId();
                 }
                 while (OverlayIconManager._instance._icons.Count <= oi.Type)
                 {
                     OverlayIconManager._instance._icons.Add(null);
                 }
                 if (OverlayIconManager._instance._icons[oi.Type] == null)
                 {
                     OverlayIconManager._instance._icons[oi.Type] = new OverlayIconManager.OverlayIconType();
                 }
                 if (oi.DistanceToOtherIcons == null)
                 {
                     oi.DistanceToOtherIcons = new Dictionary <int, float>();
                     oi.TargetPosition       = oi.target.position;
                 }
                 if (oi.Type != 0 && oi.Type != 6)
                 {
                     for (int i = 0; i < OverlayIconManager._instance._icons[oi.Type]._icons.Count; i++)
                     {
                         OverlayIcon overlayIcon = OverlayIconManager._instance._icons[oi.Type]._icons[i];
                         float       num         = Vector3.Distance(oi.TargetPosition, overlayIcon.TargetPosition);
                         oi.DistanceToOtherIcons.Add(overlayIcon.ID, num);
                         overlayIcon.DistanceToOtherIcons.Add(oi.ID, num);
                         if (num < OverlayIconManager._instance._groupingRange)
                         {
                             oi.InGroupingRangeIcons++;
                             overlayIcon.InGroupingRangeIcons++;
                         }
                         if (num < OverlayIconManager._instance._superGroupingRange)
                         {
                             oi.InSuperGroupingRangeIcons++;
                             overlayIcon.InSuperGroupingRangeIcons++;
                         }
                     }
                     OverlayIconManager._instance._icons[oi.Type]._icons.Add(oi);
                     OverlayIconManager._instance._icons[oi.Type].ProcessGroups(OverlayIconManager._instance._groupingRange, OverlayIconManager._instance._superGroupingRange);
                 }
                 else
                 {
                     OverlayIconManager._instance._icons[oi.Type]._icons.Add(oi);
                 }
             }
             else
             {
                 OverlayIconManager._instance._dynamicIcons._icons.Add(oi);
                 oi.ShouldRefreshTargetPosition = true;
                 oi.BreakGroupAlpha             = 1f;
                 oi.BreakSuperGroupAlpha        = 1f;
                 oi.CurrentGroup = oi;
                 if (oi.target == oi.transform)
                 {
                     oi.target = oi.transform.parent;
                 }
             }
         }
     }
     else
     {
         oi.DoUpdate(false, false);
     }
 }