void OnTeleportSoundSelection(AudioClip pTeleportSound) { if (pTeleportSound == null) { return; } string[] aAssetFolder = { "Assets/ScriptableObjects/Asset Meta Data" }; if (!AssetDatabase.IsValidFolder(aAssetFolder[0])) { GenHelpers.ShowSelectionWarning(); ResetTeleportSelection(); return; } string[] aAssetGUIDs = AssetDatabase.FindAssets(pTeleportSound.name, aAssetFolder); if (aAssetGUIDs.Length > 0) { string aPath = AssetDatabase.GUIDToAssetPath(aAssetGUIDs[0]); if (AssetDatabase.GetMainAssetTypeAtPath(aPath) == typeof(AssetMetaData)) { AssetMetaData aCurrentAssetData = (AssetMetaData)AssetDatabase.LoadAssetAtPath(aPath, typeof(AssetMetaData)); if (aCurrentAssetData.mType == AssetMetaData.AssetType.AudioAsset) { mActivePlayer.mGUIDTeleportSound = aCurrentAssetData.mGUID; mActivePlayer.mTeleportSound = pTeleportSound; } else { GenHelpers.ShowSelectionWarning(); ResetTeleportSelection(); return; } } else { GenHelpers.ShowSelectionWarning(); ResetTeleportSelection(); return; } } else { GenHelpers.ShowSelectionWarning(); ResetTeleportSelection(); return; } }
void OnProjectileSelection(Projectile pProjectile) { if (pProjectile == null) { return; } string[] aAssetFolder = { "Assets/ScriptableObjects/Asset Meta Data" }; if (!AssetDatabase.IsValidFolder(aAssetFolder[0])) { GenHelpers.ShowSelectionWarning(); ResetProjectileSelection(); return; } string[] aAssetGUIDs = AssetDatabase.FindAssets(pProjectile.name, aAssetFolder); if (aAssetGUIDs.Length > 0) { string aPath = AssetDatabase.GUIDToAssetPath(aAssetGUIDs[0]); if (AssetDatabase.GetMainAssetTypeAtPath(aPath) == typeof(AssetMetaData)) { AssetMetaData aCurrentAssetData = (AssetMetaData)AssetDatabase.LoadAssetAtPath(aPath, typeof(AssetMetaData)); if (aCurrentAssetData.mType == AssetMetaData.AssetType.PrefabAsset) { mActivePlayer.mGUIDProjectile = aCurrentAssetData.mGUID; mActivePlayer.mProjectile = pProjectile; } else { GenHelpers.ShowSelectionWarning(); ResetProjectileSelection(); return; } } else { GenHelpers.ShowSelectionWarning(); ResetProjectileSelection(); return; } } else { GenHelpers.ShowSelectionWarning(); ResetProjectileSelection(); return; } }