Added Feel plugin

This commit is contained in:
journaliciouz
2025-12-11 14:49:16 +01:00
parent 97dce4aaf6
commit 1942a531d4
2820 changed files with 257786 additions and 9 deletions

View File

@@ -0,0 +1,74 @@
using UnityEngine;
using System.Collections;
namespace MoreMountains.Tools
{
/// <summary>
/// Add this class to a ParticleSystem so it auto destroys once it has stopped emitting.
/// Make sure your ParticleSystem isn't looping, otherwise this script will be useless
/// </summary>
[AddComponentMenu("More Mountains/Tools/Particles/MM Auto Destroy Particle System")]
public class MMAutoDestroyParticleSystem : MonoBehaviour
{
/// True if the ParticleSystem should also destroy its parent
public bool DestroyParent = false;
/// If for some reason your particles don't get destroyed automatically at the end of the emission, you can force a destroy after a delay. Leave it at zero otherwise.
public float DestroyDelay = 0f;
protected ParticleSystem _particleSystem;
protected float _startTime;
protected bool _started = false;
/// <summary>
/// Initialization, we get the ParticleSystem component
/// </summary>
protected virtual void Start()
{
_started = false;
_particleSystem = GetComponent<ParticleSystem>();
if (DestroyDelay != 0)
{
_startTime = Time.time;
}
}
/// <summary>
/// When the ParticleSystem stops playing, we destroy it.
/// </summary>
protected virtual void Update()
{
if ( (DestroyDelay != 0) && (Time.time - _startTime > DestroyDelay) )
{
DestroyParticleSystem();
}
if (_particleSystem.isPlaying)
{
_started = true;
return;
}
DestroyParticleSystem();
}
/// <summary>
/// Destroys the particle system.
/// </summary>
protected virtual void DestroyParticleSystem()
{
if (!_started)
{
return;
}
if (transform.parent!=null)
{
if(DestroyParent)
{
Destroy(transform.parent.gameObject);
}
}
Destroy (gameObject);
}
}
}

View File

@@ -0,0 +1,20 @@
fileFormatVersion: 2
guid: f13474093d5e96142b32136ddb5a8a14
timeCreated: 1523900445
licenseType: Store
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMTools/Accessories/MMParticles/MMAutoDestroyParticleSystem.cs
uploadId: 830868

View File

@@ -0,0 +1,43 @@
using UnityEngine;
using System.Collections;
namespace MoreMountains.Tools
{
[ExecuteAlways]
/// <summary>
/// Adds this class to a UnityStandardAssets.ImageEffects.GlobalFog to change its color
/// Why this is not native, I don't know.
/// </summary>
[AddComponentMenu("More Mountains/Tools/Particles/MM Change Fog Color")]
public class MMChangeFogColor : MonoBehaviour
{
/// Adds this class to a UnityStandardAssets.ImageEffects.GlobalFog to change its color
[MMInformation("Adds this class to a UnityStandardAssets.ImageEffects.GlobalFog to change its color", MMInformationAttribute.InformationType.Info,false)]
public Color FogColor;
/// <summary>
/// Sets the fog's color to the one set in the inspector
/// </summary>
protected virtual void SetupFogColor ()
{
RenderSettings.fogColor = FogColor;
RenderSettings.fog = true;
}
/// <summary>
/// On Start(), we set the fog's color
/// </summary>
protected virtual void Start()
{
SetupFogColor();
}
/// <summary>
/// Whenever there's a change in the camera's inspector, we change the fog's color
/// </summary>
protected virtual void OnValidate()
{
SetupFogColor();
}
}
}

View File

@@ -0,0 +1,20 @@
fileFormatVersion: 2
guid: ee885a74e6f1bb84989b1a044de340cf
timeCreated: 1523900472
licenseType: Store
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMTools/Accessories/MMParticles/MMChangeFogColor.cs
uploadId: 830868

View File

@@ -0,0 +1,52 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace MoreMountains.Tools
{
[ExecuteAlways]
/// <summary>
/// MM delay particles.
/// </summary>
[AddComponentMenu("More Mountains/Tools/Particles/MM Delay Particles")]
public class MMDelayParticles : MonoBehaviour
{
[Header("Delay")]
/// the duration of the delay, in seconds
public float Delay;
/// if this is true, this will delay by the same amount all children particle systems of this object
public bool DelayChildren = true;
/// if this is true, the delay will be applied on Start
public bool ApplyDelayOnStart = false;
[MMInspectorButtonAttribute("ApplyDelay")]
public bool ApplyDelayButton;
protected Component[] particleSystems;
protected virtual void Start()
{
if (ApplyDelayOnStart)
{
ApplyDelay();
}
}
protected virtual void ApplyDelay()
{
if (this.gameObject.GetComponent<ParticleSystem>() != null)
{
ParticleSystem.MainModule main = this.gameObject.GetComponent<ParticleSystem>().main;
main.startDelay = main.startDelay.constant + Delay;
}
particleSystems = GetComponentsInChildren<ParticleSystem>();
foreach (ParticleSystem system in particleSystems)
{
ParticleSystem.MainModule main = system.main;
main.startDelay = main.startDelay.constant + Delay;
}
}
}
}

View File

@@ -0,0 +1,20 @@
fileFormatVersion: 2
guid: 03d0a01e308ebd141ba5386b17e109e3
timeCreated: 1523900445
licenseType: Store
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMTools/Accessories/MMParticles/MMDelayParticles.cs
uploadId: 830868

View File

@@ -0,0 +1,10 @@
using UnityEngine;
using System.Collections;
namespace MoreMountains.Tools
{
[AddComponentMenu("More Mountains/Tools/Particles/MM Renderer Sorting Layer")]
public class MMRendererSortingLayer : MonoBehaviour
{
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 1b89e406878a092438282239ce29006e
timeCreated: 1491155844
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMTools/Accessories/MMParticles/MMRendererSortingLayer.cs
uploadId: 830868

View File

@@ -0,0 +1,107 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Unity.Collections;
using UnityEngine;
namespace MoreMountains.Tools
{
/// <summary>
/// Add this class to a particle system at runtime, and it'll expose controls to play/pause/stop it from the inspector
/// Because Unity's built-in controls somehow lack pause when in play mode
/// </summary>
[RequireComponent(typeof(ParticleSystem))]
public class MMRuntimeParticleControl : MonoBehaviour
{
/// <summary>
/// The possible modes for the tracker :
/// Basic will work with the main module's duration
/// ForcedBounds lets you specify within which bounds the slider should move
/// </summary>
public enum TrackerModes { Basic, ForcedBounds }
[Header("Base Controls")]
/// a test button to play the associated particle system
[MMInspectorButton("Play")] public bool PlayButton;
/// a test button to pause the associated particle system
[MMInspectorButton("Pause")] public bool PauseButton;
/// a test button to stop the associated particle system
[MMInspectorButton("Stop")] public bool StopButton;
[Header("Simulate")]
/// the timestamp at which to go when pressing the Simulate button
public float TargetTimestamp = 1f;
/// a test button to move the associated particle system to the specified timestamp
[MMInspectorButton("Simulate")] public bool FastForwardToTimeButton;
[Header("Tracker")]
/// the selected tracker mode
public TrackerModes TrackerMode = TrackerModes.Basic;
/// when in ForcedBounds mode, the value to which the slider's lowest bound should be remapped
[MMEnumCondition("TrackerMode", (int)TrackerModes.ForcedBounds)]
public float MinBound;
/// when in ForcedBounds mode, the value to which the slider's highest bound should be remapped
[MMEnumCondition("TrackerMode", (int)TrackerModes.ForcedBounds)]
public float MaxBound;
/// a slider used to move the particle system through time at runtime
[Range(0f, 1f)]
public float Tracker;
[MMReadOnly]
public float Timestamp;
protected ParticleSystem _particleSystem;
protected ParticleSystem.MainModule _mainModule;
/// <summary>
/// On Awake we grab our components
/// </summary>
protected virtual void Awake()
{
_particleSystem = this.GetComponent<ParticleSystem>();
_mainModule = _particleSystem.main;
}
/// <summary>
/// Plays the particle system
/// </summary>
protected virtual void Play()
{
_particleSystem.Play();
}
/// <summary>
/// Pauses the particle system
/// </summary>
protected virtual void Pause()
{
_particleSystem.Pause();
}
/// <summary>
/// Stops the particle system
/// </summary>
protected virtual void Stop()
{
_particleSystem.Stop();
}
/// <summary>
/// Moves the particle system to the specified timestamp
/// </summary>
protected virtual void Simulate()
{
_particleSystem.Simulate(TargetTimestamp, true, true);
}
/// <summary>
/// On validate, moves the particle system to the chosen timestamp along the track
/// </summary>
protected void OnValidate()
{
float minBound = (TrackerMode == TrackerModes.Basic) ? 0f : MinBound;
float maxBound = (TrackerMode == TrackerModes.Basic) ? _mainModule.duration : MaxBound;
Timestamp = MMMaths.Remap(Tracker, 0f, 1f, minBound, maxBound);
_particleSystem.Simulate(Timestamp, true, true);
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 8dc3e8a4ec6c8c54d8507f3736517ac5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMTools/Accessories/MMParticles/MMRuntimeParticleControl.cs
uploadId: 830868

View File

@@ -0,0 +1,10 @@
using UnityEngine;
using System.Collections;
namespace MoreMountains.Tools
{
[AddComponentMenu("More Mountains/Tools/Particles/MM Trail Renderer Sorting Layer")]
public class MMTrailRendererSortingLayer : MonoBehaviour
{
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: e334a8b808ebad34dbfc09a6aa9f1102
timeCreated: 1491155844
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMTools/Accessories/MMParticles/MMTrailRendererSortingLayer.cs
uploadId: 830868

View File

@@ -0,0 +1,20 @@
using UnityEngine;
using System.Collections;
namespace MoreMountains.Tools
{
/// <summary>
/// Adds this class to particles to force their sorting layer
/// </summary>
[AddComponentMenu("More Mountains/Tools/Particles/MM Visible Particle")]
public class MMVisibleParticle : MonoBehaviour {
/// <summary>
/// Sets the particle system's renderer to the Visible Particles sorting layer
/// </summary>
protected virtual void Start ()
{
GetComponent<ParticleSystem>().GetComponent<Renderer>().sortingLayerName = "VisibleParticles";
}
}
}

View File

@@ -0,0 +1,20 @@
fileFormatVersion: 2
guid: 1b57176af794a1544ab1d2b6a1b25e8f
timeCreated: 1523900488
licenseType: Store
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMTools/Accessories/MMParticles/MMVisibleParticle.cs
uploadId: 830868