Пример #1
0
 /// <summary>
 /// Updates the mount points scale.
 /// </summary>
 public void ScaleMountPoints()
 {
     if (mountPointsLayer != null)
     {
         MountPointScaler scaler = mountPointsLayer.GetComponent <MountPointScaler>();
         if (scaler != null)
         {
             scaler.ScaleMountPoints();
         }
     }
 }
Пример #2
0
        /// <summary>
        /// Redraws the mounts points but only in editor time. This is automatically called by Redraw(). Used internally by the Map Editor. You should not need to call this method directly.
        /// </summary>
        public void DrawMountPoints()
        {
            // Create mount points layer
            Transform t = transform.Find(MOUNT_POINTS_LAYER);

            if (t != null)
            {
                DestroyImmediate(t.gameObject);
            }
            if (Application.isPlaying || mountPoints == null)
            {
                return;
            }

            mountPointsLayer = new GameObject(MOUNT_POINTS_LAYER);
            mountPointsLayer.transform.SetParent(transform, false);
            mountPointsLayer.layer = gameObject.layer;
            if (_earthInvertedMode)
            {
                mountPointsLayer.transform.localScale *= 0.99f;
            }

            // Draw mount points marks
            int mountPointCount = mountPoints.Count;

            for (int k = 0; k < mountPointCount; k++)
            {
                MountPoint mp    = mountPoints [k];
                GameObject mpObj = Instantiate(mountPointSpot);
                mpObj.name = k.ToString();
                mpObj.transform.position = transform.TransformPoint(mp.unitySphereLocation);
                if (_earthInvertedMode)
                {
                    mpObj.transform.LookAt(transform.position + mp.unitySphereLocation * 2);
                }
                else
                {
                    mpObj.transform.LookAt(transform.position);
                }
                mpObj.hideFlags = HideFlags.DontSave | HideFlags.HideInHierarchy;
                mpObj.transform.SetParent(mountPointsLayer.transform, true);
            }

            MountPointScaler mpScaler = mountPointsLayer.GetComponent <MountPointScaler> () ?? mountPointsLayer.AddComponent <MountPointScaler> ();

            mpScaler.map = this;
            mpScaler.ScaleMountPoints();
        }