/// <summary> /// Starting function setup /// </summary> void Start() { storedColor = m_uiTextColor; if (m_textContent != null) { m_textContent.color = storedColor; #if UNITY_EDITOR if (!m_textContent.text.Contains("Open the Location Manager")) { string locationProfilePath = GaiaUtils.GetAssetPath("Location Profile.asset"); if (!string.IsNullOrEmpty(locationProfilePath)) { LocationSystemScriptableObject locationProfile = AssetDatabase.LoadAssetAtPath <LocationSystemScriptableObject>(locationProfilePath); if (locationProfile != null) { m_textContent.text += "\r\n\r\nOpen the Location Manager from the Advanced Tab in the Gaia Manager to bookmark interesting locations:\r\n"; m_textContent.text += string.Format("{0} + {1} (new bookmark), {0} + {2} / {3} (cycle bookmarks)", locationProfile.m_mainKey.ToString(), locationProfile.m_addBookmarkKey.ToString(), locationProfile.m_prevBookmark.ToString(), locationProfile.m_nextBookmark.ToString()); m_textContent.text += "\r\n\r\n"; } } } #endif } }
private void Initilize() { if (m_locationProfile == null) { #if UNITY_EDITOR m_locationProfile = UnityEditor.AssetDatabase.LoadAssetAtPath <LocationSystemScriptableObject>(GaiaUtils.GetAssetPath("Location Profile.asset")); #endif } }
public static void CreateLocationProfiles() { LocationSystemScriptableObject asset = ScriptableObject.CreateInstance <LocationSystemScriptableObject>(); AssetDatabase.CreateAsset(asset, "Assets/Location Profile.asset"); AssetDatabase.SaveAssets(); EditorUtility.FocusProjectWindow(); Selection.activeObject = asset; }
private void Update() { if (Application.isPlaying) { if (m_camera == null || m_locationProfile == null) { return; } if (m_trackPlayer) { m_locationProfile.SaveLocation(m_camera, m_player); } if (Input.GetKey(m_locationProfile.m_mainKey) && Input.GetKeyDown(m_locationProfile.m_prevBookmark)) { m_selectedBookmark--; if (m_selectedBookmark < 0) { m_selectedBookmark = m_locationProfile.m_bookmarkedLocationNames.Count - 1; } m_locationProfile.LoadBookmark(this); } if (Input.GetKey(m_locationProfile.m_mainKey) && Input.GetKeyDown(m_locationProfile.m_nextBookmark)) { m_selectedBookmark++; if (m_selectedBookmark > m_locationProfile.m_bookmarkedLocationNames.Count - 1) { m_selectedBookmark = 0; } m_locationProfile.LoadBookmark(this); } if (Input.GetKey(m_locationProfile.m_mainKey) && Input.GetKeyDown(m_locationProfile.m_addBookmarkKey)) { LocationBookmarkSettings settings = LocationSystemScriptableObject.GetCurrentLocation(this); string name = "Bookmark " + " Position(" + settings.m_savedCameraPosition.x + ", " + settings.m_savedCameraPosition.y + ", " + settings.m_savedCameraPosition.z + ")"; m_locationProfile.AddNewBookmark(this, name); m_selectedBookmark = m_locationProfile.m_bookmarkedLocationNames.Count - 1; Debug.Log("New Bookmark: " + name); } } }