Insanely huge initial commit

This commit is contained in:
2026-02-21 16:40:15 -08:00
parent 208d626100
commit f74c547a13
33825 changed files with 5213498 additions and 0 deletions

View File

@@ -0,0 +1,168 @@
using UnityEngine;
#if ENABLE_INPUT_SYSTEM && !ENABLE_LEGACY_INPUT_MANAGER
using UnityEngine.InputSystem;
#endif
namespace MoreMountains.Feel
{
/// <summary>
/// This class contains a number of helper methods that will check for input in both the old and the new input system.
/// </summary>
public static class FeelDemosInputHelper
{
private const string _horizontalAxis = "Horizontal";
private const string _verticalAxis = "Vertical";
public static bool CheckMainActionInputPressedThisFrame()
{
bool input = false;
#if ENABLE_INPUT_SYSTEM && !ENABLE_LEGACY_INPUT_MANAGER
input = Keyboard.current.spaceKey.wasPressedThisFrame
|| Mouse.current.leftButton.wasPressedThisFrame;
#else
input = (Input.GetKeyDown(KeyCode.Space)
|| Input.GetKeyDown(KeyCode.Joystick1Button0)
|| Input.GetMouseButtonDown(0));
#endif
return input;
}
public static bool CheckMainActionInputPressed()
{
bool input = false;
#if ENABLE_INPUT_SYSTEM && !ENABLE_LEGACY_INPUT_MANAGER
input = Keyboard.current.spaceKey.isPressed
|| Mouse.current.leftButton.isPressed;
#else
input = (Input.GetKey(KeyCode.Space)
|| Input.GetKey(KeyCode.Joystick1Button0)
|| Input.GetMouseButton(0));
#endif
return input;
}
public static bool CheckMainActionInputUpThisFrame()
{
bool input = false;
#if ENABLE_INPUT_SYSTEM && !ENABLE_LEGACY_INPUT_MANAGER
input = Keyboard.current.spaceKey.wasReleasedThisFrame
|| Mouse.current.leftButton.wasReleasedThisFrame;
#else
input = (Input.GetKeyUp(KeyCode.Space)
|| Input.GetKeyUp(KeyCode.Joystick1Button0)
|| Input.GetMouseButtonUp(0));
#endif
return input;
}
public static bool CheckEnterPressedThisFrame()
{
bool input = false;
#if ENABLE_INPUT_SYSTEM && !ENABLE_LEGACY_INPUT_MANAGER
input = Keyboard.current.enterKey.wasPressedThisFrame;
#else
input = (Input.GetKeyDown(KeyCode.Return));
#endif
return input;
}
public static bool CheckMouseDown()
{
bool input = false;
#if ENABLE_INPUT_SYSTEM && !ENABLE_LEGACY_INPUT_MANAGER
input = Mouse.current.leftButton.wasReleasedThisFrame;
#else
input = Input.GetMouseButtonUp(0);
#endif
return input;
}
public static Vector2 MousePosition()
{
#if ENABLE_INPUT_SYSTEM && !ENABLE_LEGACY_INPUT_MANAGER
return Mouse.current.position.ReadValue();
#else
return Input.mousePosition;
#endif
}
public static Vector2 GetDirectionAxis(ref Vector2 direction)
{
direction.x = 0f;
direction.y = 0f;
#if ENABLE_INPUT_SYSTEM && !ENABLE_LEGACY_INPUT_MANAGER
if (Keyboard.current.leftArrowKey.isPressed)
{
direction.x = -1f;
}
else if (Keyboard.current.rightArrowKey.isPressed)
{
direction.x = 1f;
}
if (Keyboard.current.downArrowKey.isPressed)
{
direction.y = -1f;
}
else if (Keyboard.current.upArrowKey.isPressed)
{
direction.y = 1f;
}
#else
direction.x = Input.GetAxis(_horizontalAxis);
direction.y = Input.GetAxis(_verticalAxis);
#endif
return direction;
}
public static bool CheckAlphaInputPressedThisFrame(int alpha)
{
bool input = false;
#if ENABLE_INPUT_SYSTEM && !ENABLE_LEGACY_INPUT_MANAGER
switch(alpha)
{
case 1:
input = Keyboard.current.digit1Key.wasPressedThisFrame;
break;
case 2:
input = Keyboard.current.digit2Key.wasPressedThisFrame;
break;
case 3:
input = Keyboard.current.digit3Key.wasPressedThisFrame;
break;
case 4:
input = Keyboard.current.digit4Key.wasPressedThisFrame;
break;
}
#else
switch(alpha)
{
case 1:
input = Input.GetKeyDown(KeyCode.Alpha1);
break;
case 2:
input = Input.GetKeyDown(KeyCode.Alpha2);
break;
case 3:
input = Input.GetKeyDown(KeyCode.Alpha3);
break;
case 4:
input = Input.GetKeyDown(KeyCode.Alpha4);
break;
}
#endif
return input;
}
}
}

View File

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

View File

@@ -0,0 +1,57 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using MoreMountains.Tools;
namespace MoreMountains.Feel
{
/// <summary>
/// This class handles the instruction texts that appear in the Feel demo scenes
/// </summary>
public class FeelDemosInstructions : MonoBehaviour
{
[Header("Bindings")]
/// a text component where we'll display instructions
public Text TargetText;
/// the delay, in seconds, before instructions disappear
public float DisappearDelay = 3f;
/// the duration, in seconds, of the instructions disappearing transition
public float DisappearDuration = 0.3f;
[Header("Texts")]
/// the text to display when running the demos on desktop
public string DesktopText = "Press space to...";
/// the text to display when running the demos on mobile
public string MobileText = "Tap anywhere to...";
protected CanvasGroup _canvasGroup;
/// <summary>
/// On Awake we detect our platform and assign text accordingly
/// </summary>
protected virtual void Awake()
{
#if UNITY_ANDROID || UNITY_IPHONE
TargetText.text = MobileText;
#else
TargetText.text = DesktopText;
#endif
_canvasGroup = this.gameObject.GetComponent<CanvasGroup>();
StartCoroutine(DisappearCo());
}
/// <summary>
/// A coroutine used to hide the instructions after a while
/// </summary>
/// <returns></returns>
protected virtual IEnumerator DisappearCo()
{
yield return MMCoroutine.WaitFor(DisappearDelay);
StartCoroutine(MMFade.FadeCanvasGroup(_canvasGroup, DisappearDuration, 0f, true));
yield return MMCoroutine.WaitFor(DisappearDuration + 0.1f);
this.gameObject.SetActive(false);
}
}
}

View File

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

View File

@@ -0,0 +1,23 @@
using System.Collections;
using System.Collections.Generic;
using MoreMountains.Feedbacks;
using UnityEngine;
namespace MoreMountains.Feel
{
/// <summary>
/// This component checks whether the user pressed Enter and plays the associated feedback if that's the case
/// </summary>
public class FeelDemosNextDemoButtonInput : MonoBehaviour
{
public MMFeedbacks OnInputFeedback;
protected virtual void Update()
{
if (FeelDemosInputHelper.CheckEnterPressedThisFrame())
{
OnInputFeedback?.PlayFeedbacks();
}
}
}
}

View File

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