예제 #1
0
        /// <summary>
        ///     Creates an empty <c>MarsMarkerDefinition</c> and adds it to the library. The new
        ///     marker is inserted at the end of the list of markers.
        /// </summary>
        /// <returns>The MarsMarkerDefinition created and added.</returns>
        public MarsMarkerDefinition CreateAndAdd()
        {
            var newMarker = new MarsMarkerDefinition
            {
                MarkerDefinitionId = SerializableGuid.empty,
                // By default marker has a size of a postcard
                Size        = new Vector2(MarkerConstants.PostcardWidthInMeters, MarkerConstants.PostcardHeightInMeters),
                SpecifySize = true,
                Label       = k_DefaultMarkerDefinitionLabel
            };

            m_Markers.Add(newMarker);

#if UNITY_EDITOR
            // Save assets to force sync with provider library and set valid GUID on new MarsMarkerDefinition
            EditorUtility.SetDirty(this);
            AssetDatabase.SaveAssets();
#endif

            return(newMarker);
        }
예제 #2
0
 /// <summary>
 ///     Get the index of MarsMarkerDefinition in the marker library.
 /// </summary>
 /// <param name="markerDefinition">The MarsMarkerDefinition to find.</param>
 /// <returns>The zero-based index of the MarsMarkerDefinition, or -1 if not found.</returns>
 public int IndexOf(MarsMarkerDefinition markerDefinition)
 {
     return(m_Markers.IndexOf(markerDefinition));
 }