Insanely huge initial commit

This commit is contained in:
2026-02-21 17:04:05 -08:00
parent 9cdd36191a
commit 613d75914a
22525 changed files with 4035207 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MoreMountains.Tools;
namespace MoreMountains.Feedbacks
{
/// <summary>
/// A class handling the lifecycle of the balls included in the MMFeedbacks demo
/// It waits for 2 seconds after the spawn of the ball, and destroys it, playing a MMFeedbacks while it does so
/// </summary>
public class DemoBall : MonoBehaviour
{
/// the duration (in seconds) of the life of the ball
public float LifeSpan = 2f;
/// the feedback to play when the ball dies
public MMFeedbacks DeathFeedback;
/// <summary>
/// On start, we trigger the programmed death of the ball
/// </summary>
protected virtual void Start()
{
StartCoroutine(ProgrammedDeath());
}
/// <summary>
/// Waits for 2 seconds, then kills the ball object after having played the MMFeedbacks
/// </summary>
/// <returns></returns>
protected virtual IEnumerator ProgrammedDeath()
{
yield return MMCoroutine.WaitFor(LifeSpan);
DeathFeedback?.PlayFeedbacks();
this.gameObject.SetActive(false);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: af269cd09768709469620a982332135d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,76 @@
using MoreMountains.Tools;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
#if UNITY_EDITOR
using UnityEditor;
using UnityEditor.Events;
#endif
namespace MoreMountains.Feedbacks
{
/// <summary>
/// A simple class used to handle demo buttons in the MMF_PlayerDemo and MMFeedbacksDemo scenes
/// </summary>
[ExecuteAlways]
public class DemoButton : MonoBehaviour
{
[Header("Behaviour")]
public bool NotSupportedInWebGL = false;
[Header("Bindings")]
public Button TargetButton;
public Text ButtonText;
public Text WebGL;
public MMF_Player TargetMMF_Player;
public MMFeedbacks TargetMMFeedbacks;
protected Color _disabledColor = new Color(255, 255, 255, 0.5f);
//[Header("Debug")]
//[MMInspectorButton("ConvertButtonToMMFPlayerDemo")]
//public bool ConvertButtonToMMFPlayerDemoButton;
protected virtual void OnEnable()
{
HandleWebGL();
}
protected virtual void ConvertButtonToMMFPlayerDemo()
{
#if UNITY_EDITOR
if (TargetMMF_Player != null)
{
TargetButton.onClick = new Button.ButtonClickedEvent();
UnityAction action = new UnityAction(TargetMMF_Player.PlayFeedbacks);
UnityEventTools.AddVoidPersistentListener(TargetButton.onClick, action);
EditorUtility.SetDirty(TargetButton);
PrefabUtility.RecordPrefabInstancePropertyModifications(gameObject.transform);
}
#endif
}
public void OnClickEvent()
{
TargetMMF_Player.PlayFeedbacks();
}
protected virtual void HandleWebGL()
{
if (WebGL != null)
{
#if UNITY_WEBGL
TargetButton.interactable = !NotSupportedInWebGL;
WebGL.gameObject.SetActive(NotSupportedInWebGL);
ButtonText.color = NotSupportedInWebGL ? _disabledColor : Color.white;
#else
WebGL.gameObject.SetActive(false);
TargetButton.interactable = true;
ButtonText.color = Color.white;
#endif
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: df25bf84edad1d74684be3596d8f570d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,20 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace MoreMountains.Feedbacks
{
/// <summary>
/// A class used on the MMFeedback's demo ghost
/// </summary>
public class DemoGhost : MonoBehaviour
{
/// <summary>
/// Called via animation event, disables the object
/// </summary>
public virtual void OnAnimationEnd()
{
this.gameObject.SetActive(false);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 69c5c5e06e4b97d419ad1fd8c422c7b6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,100 @@
using MoreMountains.Tools;
using UnityEngine;
using UnityEditor;
namespace MoreMountains.Feedbacks
{
/// <summary>
/// This class, meant to be used in MMFeedbacks demos, will check for requirements, and output an
/// error message if necessary.
/// </summary>
public class DemoPackageTester : MonoBehaviour
{
[MMFInformation("This component is only used to display an error in the console in case dependencies for this demo haven't been installed. You can safely remove it if you want, and typically you wouldn't want to keep that in your own game.", MMFInformationAttribute.InformationType.Warning, false)]
/// does the scene require post processing to be installed?
public bool RequiresPostProcessing;
/// does the scene require TextMesh Pro to be installed?
public bool RequiresTMP;
/// does the scene require Cinemachine to be installed?
public bool RequiresCinemachine;
/// <summary>
/// On Awake we test for dependencies
/// </summary>
protected virtual void Awake()
{
#if UNITY_EDITOR
if (Application.isPlaying)
{
TestForDependencies();
}
#endif
}
/// <summary>
/// Checks whether or not dependencies have been correctly installed
/// </summary>
protected virtual void TestForDependencies()
{
bool missingDependencies = false;
string missingString = "";
bool cinemachineFound = false;
bool tmpFound = false;
bool postProcessingFound = false;
#if MM_CINEMACHINE
cinemachineFound = true;
#endif
#if MM_TEXTMESHPRO
tmpFound = true;
#endif
#if MM_POSTPROCESSING
postProcessingFound = true;
#endif
if (missingDependencies)
{
// we do nothing but without that we get an annoying warning so here we are.
}
if (RequiresCinemachine && !cinemachineFound)
{
missingDependencies = true;
missingString += "Cinemachine";
}
if (RequiresTMP && !tmpFound)
{
missingDependencies = true;
if (missingString != "") { missingString += ", "; }
missingString += "TextMeshPro";
}
if (RequiresPostProcessing && !postProcessingFound)
{
missingDependencies = true;
if (missingString != "") { missingString += ", "; }
missingString += "PostProcessing";
}
#if UNITY_EDITOR
if (missingDependencies)
{
Debug.LogError("[DemoPackageTester] It looks like you're missing some dependencies required by this demo ("+missingString+")." +
" You'll have to install them to run this demo. You can learn more about how to do so in the documentation, at http://feel-docs.moremountains.com/how-to-install.html" +
"\n\n");
if (EditorUtility.DisplayDialog("Missing dependencies!",
"This demo requires a few dependencies to be installed first (Cinemachine, TextMesh Pro, PostProcessing).\n\n" +
"You can use Feel without them of course, but this demo needs them to work (check out the documentation to learn more!).\n\n" +
"Would you like to automatically install them?", "Yes, install dependencies", "No"))
{
MMFDependencyInstaller.InstallFromPlay();
}
}
#endif
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1ac950cd485569740affc32a280665ea
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,153 @@
#if UNITY_EDITOR
using UnityEditor;
using UnityEditor.PackageManager.Requests;
using UnityEditor.PackageManager;
#endif
using UnityEngine;
using System.Threading.Tasks;
namespace MoreMountains.Feedbacks
{
/// <summary>
/// This class is used to automatically install optional dependencies used in MMFeedbacks
/// </summary>
public static class MMFDependencyInstaller
{
#if UNITY_EDITOR
static ListRequest _listRequest;
static AddRequest _addRequest;
static int _currentIndex;
private static string[] _packages = new string[]
{"com.unity.cinemachine",
"com.unity.postprocessing",
"com.unity.textmeshpro",
"com.unity.2d.animation"
};
/// <summary>
/// Installs all dependencies listed in _packages
/// </summary>
[MenuItem("Tools/More Mountains/MMFeedbacks/Install All Dependencies", false, 703)]
public static void InstallAllDependencies()
{
_currentIndex = 0;
_listRequest = null;
_addRequest = null;
Debug.Log("[MMFDependencyInstaller] Installation start");
_listRequest = Client.List();
EditorApplication.update += ListProgress;
}
/// <summary>
/// Installs all dependencies, use this when calling from a running application
/// </summary>
public async static void InstallFromPlay()
{
EditorApplication.ExitPlaymode();
while (Application.isPlaying)
{
await Task.Delay(500);
}
await Task.Delay(500);
ClearConsole();
await Task.Delay(500);
InstallAllDependencies();
}
/// <summary>
/// Clears the console. Why isn't this a built-in one liner? Who knows.
/// </summary>
public static void ClearConsole()
{
var logEntries = System.Type.GetType("UnityEditor.LogEntries, UnityEditor.dll");
if (logEntries != null)
{
var clearMethod = logEntries.GetMethod("Clear", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public);
if (clearMethod != null)
{
clearMethod.Invoke(null, null);
}
}
}
/// <summary>
/// Proceeds to install the next package in line
/// </summary>
static void InstallNext()
{
if (_currentIndex < _packages.Length)
{
bool packageFound = false;
foreach (var package in _listRequest.Result)
{
if (package.name == _packages[_currentIndex])
{
packageFound = true;
Debug.Log("[MMFDependencyInstaller] "+package.name+" is already installed");
_currentIndex++;
InstallNext();
return;
}
}
if (!packageFound)
{
Debug.Log("[MMFDependencyInstaller] installing "+_packages[_currentIndex]);
_addRequest = Client.Add(_packages[_currentIndex]);
EditorApplication.update += AddProgress;
}
}
else
{
Debug.Log("[MMFDependencyInstaller] Installation complete");
Debug.Log("[MMFDependencyInstaller] It's recommended to now close that scene and reopen it before playing it.");
}
}
/// <summary>
/// Processes the list request
/// </summary>
static void ListProgress()
{
if (_listRequest.IsCompleted)
{
EditorApplication.update -= ListProgress;
if (_listRequest.Status == StatusCode.Success)
{
InstallNext();
}
else if (_listRequest.Status >= StatusCode.Failure)
{
Debug.Log(_listRequest.Error.message);
}
}
}
/// <summary>
/// Processes add requests
/// </summary>
static void AddProgress()
{
if (_addRequest.IsCompleted)
{
if (_addRequest.Status == StatusCode.Success)
{
Debug.Log("[MMFDependencyInstaller] "+_addRequest.Result.packageId+" has been installed");
_currentIndex++;
InstallNext();
}
else if (_addRequest.Status >= StatusCode.Failure)
{
Debug.Log(_addRequest.Error.message);
}
EditorApplication.update -= AddProgress;
}
}
#endif
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f486667260dbdcb4cadd460c2fd25885
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: