Exemplo n.º 1
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");

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

            mountPointsLayer = new GameObject("Mount Points");
            mountPointsLayer.transform.SetParent(transform, false);

            // Draw mount points marks
            for (int k = 0; k < mountPoints.Count; k++)
            {
                MountPoint mp    = mountPoints [k];
                GameObject mpObj = Instantiate(mountPointSpot);
                mpObj.name = k.ToString();
                mpObj.transform.position = transform.TransformPoint(mp.unity2DLocation);
                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();
        }
Exemplo n.º 2
0
 /// <summary>
 /// Updates the mount points scale.
 /// </summary>
 public void ScaleMountPoints()
 {
     if (mountPointsLayer != null)
     {
         MountPointScaler scaler = mountPointsLayer.GetComponent <MountPointScaler>();
         if (scaler != null)
         {
             scaler.ScaleMountPoints();
         }
     }
 }