2026-05-29 웨이브 시스템
This commit is contained in:
BIN
Assets/01_Scenes/BossScene.unity
LFS
BIN
Assets/01_Scenes/BossScene.unity
LFS
Binary file not shown.
BIN
Assets/01_Scenes/GameScene.unity
LFS
BIN
Assets/01_Scenes/GameScene.unity
LFS
Binary file not shown.
@@ -72,4 +72,9 @@ private async void RunPhaseTransition()
|
||||
_isTransitioning = false;
|
||||
OnPhaseChanged?.Invoke(_currentPhase);
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
GameManager.Instance.WaveM.GameClear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Threading;
|
||||
using TMPro;
|
||||
using UnityEditor.Playables;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
// ============================================================================
|
||||
// WaveManager
|
||||
@@ -61,8 +65,15 @@ public class WaveManager : MonoBehaviour
|
||||
private readonly List<Enemy> _aliveEnemies = new();
|
||||
private CancellationTokenSource _waveCts; // 전체 웨이브 진행 취소 토큰 (OnDestroy/StopWaves에서 취소)
|
||||
|
||||
[SerializeField] private Button BossZoneButton;
|
||||
public TMP_Text WaveText;
|
||||
public TMP_Text GameClearText;
|
||||
|
||||
|
||||
|
||||
private void Start()
|
||||
{
|
||||
OnAllWavesCleared += StageClearEvent;
|
||||
if (_startOnAwake) StartWaves();
|
||||
}
|
||||
|
||||
@@ -72,11 +83,33 @@ private void OnDestroy()
|
||||
_waveCts?.Dispose();
|
||||
}
|
||||
|
||||
private async Awaitable WaveUIOn()
|
||||
{
|
||||
try
|
||||
{
|
||||
WaveText.text = $"Wave {CurrentWaveIndex + 1}";
|
||||
WaveText.gameObject.SetActive(true);
|
||||
|
||||
|
||||
await Awaitable.WaitForSecondsAsync(3.0f, destroyCancellationToken);
|
||||
|
||||
WaveText.gameObject.SetActive(false);
|
||||
}
|
||||
catch (System.OperationCanceledException)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// 외부에서 호출해 웨이브 시작 (예: UI 버튼, 트리거).
|
||||
public void StartWaves()
|
||||
{
|
||||
Debug.Log("aaaa");
|
||||
|
||||
if (_waves == null || _waves.Count == 0) return;
|
||||
RunAllWaves();
|
||||
|
||||
_ = WaveUIOn();
|
||||
}
|
||||
|
||||
// 진행 중인 웨이브 강제 중단. 게임 오버/메뉴 진입 등에 사용.
|
||||
@@ -249,6 +282,7 @@ private void DestroyAliveEnemies()
|
||||
// 디버그용 OnGUI 표시. 실제 게임 UI는 별도로 구성하고 이건 빠르게 확인용.
|
||||
private void OnGUI()
|
||||
{
|
||||
/*
|
||||
GUIStyle style = new GUIStyle(GUI.skin.box)
|
||||
{
|
||||
fontSize = 22,
|
||||
@@ -280,6 +314,7 @@ private void OnGUI()
|
||||
}
|
||||
|
||||
GUI.Box(new Rect(Screen.width / 2f - 180f, 20f, 360f, 110f), text, style);
|
||||
*/
|
||||
}
|
||||
|
||||
private void OnDrawGizmosSelected()
|
||||
@@ -312,4 +347,15 @@ private void OnDrawGizmosSelected()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void StageClearEvent()
|
||||
{
|
||||
BossZoneButton.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
|
||||
public void GameClear()
|
||||
{
|
||||
GameClearText.gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
public class GameManager : MonoBehaviour,ISceneInitializable
|
||||
@@ -7,6 +8,8 @@ public class GameManager : MonoBehaviour,ISceneInitializable
|
||||
public SkillSupport SkillSupporter {get; private set;}
|
||||
public PlayerController LocalPlayer {get; private set;}
|
||||
|
||||
public WaveManager WaveM {get; private set;}
|
||||
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
@@ -22,8 +25,8 @@ private void Awake()
|
||||
|
||||
public void OnSceneLoaded()
|
||||
{
|
||||
Debug.Log("aaaa");
|
||||
SkillSupporter = Object.FindFirstObjectByType<SkillSupport>();
|
||||
LocalPlayer = Object.FindFirstObjectByType<PlayerController>();
|
||||
WaveM = Object.FindFirstObjectByType<WaveManager>();
|
||||
}
|
||||
}
|
||||
|
||||
BIN
Assets/03_Character/ColorMan/Prefabs/YellowMan.prefab
LFS
Normal file
BIN
Assets/03_Character/ColorMan/Prefabs/YellowMan.prefab
LFS
Normal file
Binary file not shown.
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e6c1cfb64ee7ec143b32b3f33b3e85f0
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
8
Assets/TextMesh Pro Effect.meta
Normal file
8
Assets/TextMesh Pro Effect.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2bdd8076392c3aa49925be36e4af394f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/TextMesh Pro Effect/Documentation.meta
Normal file
8
Assets/TextMesh Pro Effect/Documentation.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9b0ac18428e5255468d5c3fcc25a9b33
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/TextMesh Pro Effect/Documentation/Documetation.pdf
LFS
Normal file
BIN
Assets/TextMesh Pro Effect/Documentation/Documetation.pdf
LFS
Normal file
Binary file not shown.
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5fd8f10a40423eb41b0321d55366ba47
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 156234
|
||||
packageName: TextMesh Pro Effect
|
||||
packageVersion: 1.63
|
||||
assetPath: Assets/TextMesh Pro Effect/Documentation/Documetation.pdf
|
||||
uploadId: 755994
|
||||
8
Assets/TextMesh Pro Effect/Editor.meta
Normal file
8
Assets/TextMesh Pro Effect/Editor.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 169ef5f7f29010d43b5eaaada3ad796a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "TextMeshProEffect.Editor",
|
||||
"references": [
|
||||
"GUID:7d8e9e122924faa4bb27c57e77d13ce7"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f60cd03d3d4d02042aeeb7482062c973
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 156234
|
||||
packageName: TextMesh Pro Effect
|
||||
packageVersion: 1.63
|
||||
assetPath: Assets/TextMesh Pro Effect/Editor/TextMeshProEffect.Editor.asmdef
|
||||
uploadId: 755994
|
||||
27
Assets/TextMesh Pro Effect/Editor/TextMeshProEffectEditor.cs
Normal file
27
Assets/TextMesh Pro Effect/Editor/TextMeshProEffectEditor.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
// ReSharper disable InconsistentNaming
|
||||
// ReSharper disable CheckNamespace
|
||||
#pragma warning disable 0649
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace TMPro.Editor
|
||||
{
|
||||
[CustomEditor(typeof(TextMeshProEffect))]
|
||||
public class TextMeshProEffectEditor : UnityEditor.Editor
|
||||
{
|
||||
public override bool RequiresConstantRepaint()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
if (!Application.isPlaying)
|
||||
{
|
||||
EditorApplication.QueuePlayerLoopUpdate();
|
||||
SceneView.RepaintAll();
|
||||
}
|
||||
base.OnInspectorGUI();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1df4a663e3074434940d6a419e9e0016
|
||||
timeCreated: 1597000388
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 156234
|
||||
packageName: TextMesh Pro Effect
|
||||
packageVersion: 1.63
|
||||
assetPath: Assets/TextMesh Pro Effect/Editor/TextMeshProEffectEditor.cs
|
||||
uploadId: 755994
|
||||
8
Assets/TextMesh Pro Effect/Examples.meta
Normal file
8
Assets/TextMesh Pro Effect/Examples.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 98f268518bdb11542a2eb246af6b22d2
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/TextMesh Pro Effect/Examples/KomikaDemo.asset
LFS
Normal file
BIN
Assets/TextMesh Pro Effect/Examples/KomikaDemo.asset
LFS
Normal file
Binary file not shown.
15
Assets/TextMesh Pro Effect/Examples/KomikaDemo.asset.meta
Normal file
15
Assets/TextMesh Pro Effect/Examples/KomikaDemo.asset.meta
Normal file
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b0f48d9d99c22c8468e45c63949f6113
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 156234
|
||||
packageName: TextMesh Pro Effect
|
||||
packageVersion: 1.63
|
||||
assetPath: Assets/TextMesh Pro Effect/Examples/KomikaDemo.asset
|
||||
uploadId: 755994
|
||||
BIN
Assets/TextMesh Pro Effect/Examples/KomikaDemo.ttf
LFS
Normal file
BIN
Assets/TextMesh Pro Effect/Examples/KomikaDemo.ttf
LFS
Normal file
Binary file not shown.
29
Assets/TextMesh Pro Effect/Examples/KomikaDemo.ttf.meta
Normal file
29
Assets/TextMesh Pro Effect/Examples/KomikaDemo.ttf.meta
Normal file
@@ -0,0 +1,29 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8c0ad88a37ec6b84ca188d44a1cbbda3
|
||||
TrueTypeFontImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 4
|
||||
fontSize: 86
|
||||
forceTextureCase: -1
|
||||
characterSpacing: 0
|
||||
characterPadding: 1
|
||||
includeFontData: 1
|
||||
fontName: Komika Title
|
||||
fontNames:
|
||||
- Komika Title
|
||||
fallbackFontReferences: []
|
||||
customCharacters:
|
||||
fontRenderingMode: 0
|
||||
ascentCalculationMode: 1
|
||||
useLegacyBoundsCalculation: 0
|
||||
shouldRoundAdvanceValue: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 156234
|
||||
packageName: TextMesh Pro Effect
|
||||
packageVersion: 1.63
|
||||
assetPath: Assets/TextMesh Pro Effect/Examples/KomikaDemo.ttf
|
||||
uploadId: 755994
|
||||
BIN
Assets/TextMesh Pro Effect/Examples/SceneTextMeshDemo.unity
LFS
Normal file
BIN
Assets/TextMesh Pro Effect/Examples/SceneTextMeshDemo.unity
LFS
Normal file
Binary file not shown.
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a6eaaae1699a82f42aa07f39e6de1f7c
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 156234
|
||||
packageName: TextMesh Pro Effect
|
||||
packageVersion: 1.63
|
||||
assetPath: Assets/TextMesh Pro Effect/Examples/SceneTextMeshDemo.unity
|
||||
uploadId: 755994
|
||||
BIN
Assets/TextMesh Pro Effect/Examples/TextMeshProEffectDemo.unity
LFS
Normal file
BIN
Assets/TextMesh Pro Effect/Examples/TextMeshProEffectDemo.unity
LFS
Normal file
Binary file not shown.
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 51d37d5d76b2b834ba49d4b6834c530a
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 156234
|
||||
packageName: TextMesh Pro Effect
|
||||
packageVersion: 1.63
|
||||
assetPath: Assets/TextMesh Pro Effect/Examples/TextMeshProEffectDemo.unity
|
||||
uploadId: 755994
|
||||
14
Assets/TextMesh Pro Effect/TextMeshProEffect.asmdef
Normal file
14
Assets/TextMesh Pro Effect/TextMeshProEffect.asmdef
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "TextMeshProEffect",
|
||||
"references": [
|
||||
"GUID:6055be8ebefd69e48b49212b09b47b2f"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": []
|
||||
}
|
||||
14
Assets/TextMesh Pro Effect/TextMeshProEffect.asmdef.meta
Normal file
14
Assets/TextMesh Pro Effect/TextMeshProEffect.asmdef.meta
Normal file
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7d8e9e122924faa4bb27c57e77d13ce7
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 156234
|
||||
packageName: TextMesh Pro Effect
|
||||
packageVersion: 1.63
|
||||
assetPath: Assets/TextMesh Pro Effect/TextMeshProEffect.asmdef
|
||||
uploadId: 755994
|
||||
583
Assets/TextMesh Pro Effect/TextMeshProEffect.cs
Normal file
583
Assets/TextMesh Pro Effect/TextMeshProEffect.cs
Normal file
@@ -0,0 +1,583 @@
|
||||
// ReSharper disable InconsistentNaming
|
||||
// ReSharper disable CheckNamespace
|
||||
#pragma warning disable 0649
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
namespace TMPro
|
||||
{
|
||||
[RequireComponent(typeof(TMP_Text))]
|
||||
[ExecuteInEditMode]
|
||||
public class TextMeshProEffect : MonoBehaviour
|
||||
{
|
||||
public enum EffectType : byte
|
||||
{
|
||||
Waves,
|
||||
Grow,
|
||||
Unfold,
|
||||
UnfoldAndWaves,
|
||||
Sketch,
|
||||
Bounce
|
||||
}
|
||||
|
||||
public enum MixType : byte
|
||||
{
|
||||
Multiply,
|
||||
Add
|
||||
}
|
||||
|
||||
[ExecuteInEditMode]
|
||||
internal class SharedState : MonoBehaviour
|
||||
{
|
||||
[NonSerialized]
|
||||
internal bool TextMeshIsUpdated;
|
||||
|
||||
private void LateUpdate()
|
||||
{
|
||||
TextMeshIsUpdated = false;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
private sealed class о
|
||||
{
|
||||
public static readonly о ò = new о();
|
||||
|
||||
public static Func<TextMeshProEffect, bool> ó;
|
||||
|
||||
internal bool ô(TextMeshProEffect ö)
|
||||
{
|
||||
return ö == null || !ö.enabled;
|
||||
}
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Auto)]
|
||||
private struct Ö
|
||||
{
|
||||
public TMP_CharacterInfo º;
|
||||
|
||||
public TextMeshProEffect Ç;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Auto)]
|
||||
private struct ü
|
||||
{
|
||||
public float é;
|
||||
|
||||
public TMP_CharacterInfo â;
|
||||
|
||||
public TextMeshProEffect ä;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Auto)]
|
||||
private struct à
|
||||
{
|
||||
public float å;
|
||||
|
||||
public TMP_CharacterInfo ç;
|
||||
|
||||
public TextMeshProEffect ê;
|
||||
}
|
||||
|
||||
public EffectType Type;
|
||||
|
||||
public float DurationInSeconds = 0.5f;
|
||||
|
||||
public float Amplitude = 1f;
|
||||
|
||||
[Space]
|
||||
[Range(0f, 1f)]
|
||||
public float CharacterDurationRatio = 0f;
|
||||
|
||||
public int CharactersPerDuration = 0;
|
||||
|
||||
[Space]
|
||||
public Gradient Gradient = new Gradient();
|
||||
|
||||
public MixType Mix = MixType.Multiply;
|
||||
|
||||
[Space]
|
||||
public bool AutoPlay = true;
|
||||
|
||||
public bool Reverse = false;
|
||||
|
||||
public bool Repeat;
|
||||
|
||||
public string ForWords;
|
||||
|
||||
private readonly List<ValueTuple<int, int>> öæ = new List<ValueTuple<int, int>>();
|
||||
|
||||
[NonSerialized]
|
||||
public bool IsFinished;
|
||||
|
||||
private float öÆ;
|
||||
|
||||
private TMP_Text öû;
|
||||
|
||||
private EffectType öù;
|
||||
|
||||
private bool öÿ;
|
||||
|
||||
private bool öÜ;
|
||||
|
||||
private bool öƒ;
|
||||
|
||||
private float öá;
|
||||
|
||||
private string öí;
|
||||
|
||||
private ushort öú;
|
||||
|
||||
private float[] öñ = new float[10];
|
||||
|
||||
private SharedState öÑ;
|
||||
|
||||
private float öª;
|
||||
|
||||
private TMP_TextInfo òo;
|
||||
|
||||
private string òο;
|
||||
|
||||
public List<ValueTuple<int, int>> Intervals => öæ;
|
||||
|
||||
private SharedState SharedStateProp
|
||||
{
|
||||
get
|
||||
{
|
||||
if (öÑ != null)
|
||||
{
|
||||
return öÑ;
|
||||
}
|
||||
öÑ = GetComponent<SharedState>();
|
||||
if (öÑ == null)
|
||||
{
|
||||
öÑ = base.gameObject.AddComponent<SharedState>();
|
||||
öÑ.hideFlags = HideFlags.HideInInspector | HideFlags.DontSaveInEditor | HideFlags.NotEditable | HideFlags.DontSaveInBuild;
|
||||
}
|
||||
return öÑ;
|
||||
}
|
||||
}
|
||||
|
||||
public void CopyTo(TextMeshProEffect effect)
|
||||
{
|
||||
effect.Type = Type;
|
||||
effect.DurationInSeconds = DurationInSeconds;
|
||||
effect.Amplitude = Amplitude;
|
||||
effect.CharacterDurationRatio = CharacterDurationRatio;
|
||||
effect.CharactersPerDuration = CharactersPerDuration;
|
||||
effect.Gradient = Gradient;
|
||||
effect.Mix = Mix;
|
||||
effect.AutoPlay = AutoPlay;
|
||||
effect.Repeat = Repeat;
|
||||
effect.ForWords = ForWords;
|
||||
}
|
||||
|
||||
public void Apply()
|
||||
{
|
||||
öû = GetComponent<TMP_Text>();
|
||||
öù = Type;
|
||||
öÿ = öù == EffectType.Unfold || öù == EffectType.Grow || öù == EffectType.Bounce;
|
||||
öÜ = öù == EffectType.Sketch;
|
||||
öƒ = false;
|
||||
öá = -1f;
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
if (AutoPlay)
|
||||
{
|
||||
Play();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
öÑ = GetComponent<SharedState>();
|
||||
if (!(öÑ == null))
|
||||
{
|
||||
TextMeshProEffect[] components = base.gameObject.GetComponents<TextMeshProEffect>();
|
||||
if (components.Length == 0 || components.All(о.ò.ô))
|
||||
{
|
||||
UnityEngine.Object.Destroy(öÑ);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnValidate()
|
||||
{
|
||||
if (AutoPlay)
|
||||
{
|
||||
Play();
|
||||
}
|
||||
else
|
||||
{
|
||||
Apply();
|
||||
}
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
{
|
||||
if ((UnityEngine.Object)(object)öû == null || DurationInSeconds <= 0f || !öƒ)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (Repeat && IsFinished)
|
||||
{
|
||||
Play();
|
||||
}
|
||||
if (TMP_Settings.instance == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!SharedStateProp.TextMeshIsUpdated)
|
||||
{
|
||||
öû.ForceMeshUpdate();
|
||||
SharedStateProp.TextMeshIsUpdated = true;
|
||||
}
|
||||
òo = öû.textInfo;
|
||||
if (òo == null || òo.meshInfo == null || òo.meshInfo.Length == 0 || òo.meshInfo[0].vertices == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
TMP_MeshInfo[] array = Array.Empty<TMP_MeshInfo>();
|
||||
if (Application.isEditor)
|
||||
{
|
||||
try
|
||||
{
|
||||
array = òo.CopyMeshInfoVertexData();
|
||||
}
|
||||
catch (NullReferenceException ex)
|
||||
{
|
||||
FieldInfo field = typeof(TMP_TextInfo).GetField("m_CachedMeshInfo", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
if (field != null)
|
||||
{
|
||||
field.SetValue(òo, null);
|
||||
}
|
||||
Debug.Log("TMP bug. Workaround applied." + ex, this);
|
||||
array = òo.CopyMeshInfoVertexData();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
array = òo.CopyMeshInfoVertexData();
|
||||
}
|
||||
int characterCount = òo.characterCount;
|
||||
if (characterCount == 0)
|
||||
{
|
||||
IsFinished = true;
|
||||
return;
|
||||
}
|
||||
float num = Time.realtimeSinceStartup - öÆ;
|
||||
if (öí != öû.text || ForWords != òο)
|
||||
{
|
||||
öá = -1f;
|
||||
öí = öû.text;
|
||||
òο = ForWords;
|
||||
ë();
|
||||
}
|
||||
if (CharactersPerDuration > 0)
|
||||
{
|
||||
öª = DurationInSeconds * (float)öí.Length / (float)CharactersPerDuration;
|
||||
}
|
||||
else
|
||||
{
|
||||
öª = DurationInSeconds;
|
||||
}
|
||||
if (öÜ && num >= öá)
|
||||
{
|
||||
öá = num + öª;
|
||||
öú++;
|
||||
if (öñ.Length < characterCount * 2)
|
||||
{
|
||||
öñ = new float[characterCount * 2];
|
||||
}
|
||||
for (int i = 0; i < öñ.Length; i++)
|
||||
{
|
||||
öñ[i] = UnityEngine.Random.value;
|
||||
}
|
||||
}
|
||||
if (öÿ && num > öª)
|
||||
{
|
||||
num = öª;
|
||||
IsFinished = true;
|
||||
}
|
||||
float num2 = num / öª;
|
||||
if (!öÿ)
|
||||
{
|
||||
num2 %= 1f;
|
||||
}
|
||||
float num3 = num2;
|
||||
if (Reverse)
|
||||
{
|
||||
num3 = 1f - num2;
|
||||
}
|
||||
float characterDurationRatio = CharacterDurationRatio;
|
||||
float num4 = Mathf.Lerp(1f / (float)characterCount, 1f, characterDurationRatio);
|
||||
int num5 = 0;
|
||||
int num6 = characterCount;
|
||||
if (öæ.Count > 0 || !string.IsNullOrEmpty(ForWords))
|
||||
{
|
||||
num6 = 0;
|
||||
for (int j = 0; j < öæ.Count; j++)
|
||||
{
|
||||
ValueTuple<int, int> valueTuple = öæ[j];
|
||||
num6 += valueTuple.Item2 - valueTuple.Item1 + 1;
|
||||
}
|
||||
}
|
||||
for (int k = 0; k < characterCount; k++)
|
||||
{
|
||||
if (öæ.Count > 0 || !string.IsNullOrEmpty(ForWords))
|
||||
{
|
||||
bool flag = false;
|
||||
for (int l = 0; l < öæ.Count; l++)
|
||||
{
|
||||
ValueTuple<int, int> valueTuple2 = öæ[l];
|
||||
if (k >= valueTuple2.Item1 && k <= valueTuple2.Item2)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
if (!flag)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
TMP_CharacterInfo ä = òo.characterInfo[k];
|
||||
if (ä.isVisible)
|
||||
{
|
||||
float num7 = Mathf.Lerp((float)num5 * 1f / (float)num6, 0f, characterDurationRatio);
|
||||
float value = (num3 - num7) / num4;
|
||||
value = Mathf.Clamp01(value);
|
||||
int materialReferenceIndex = ä.materialReferenceIndex;
|
||||
int vertexIndex = ä.vertexIndex;
|
||||
Color32[] colors = òo.meshInfo[materialReferenceIndex].colors32;
|
||||
Vector3[] vertices = array[materialReferenceIndex].vertices;
|
||||
Vector3[] vertices2 = òo.meshInfo[materialReferenceIndex].vertices;
|
||||
î(òo, ä, vertexIndex, colors, vertices2, vertices, num3, value, öú);
|
||||
num5++;
|
||||
}
|
||||
}
|
||||
for (int m = 0; m < òo.meshInfo.Length; m++)
|
||||
{
|
||||
if (m < òo.materialCount)
|
||||
{
|
||||
òo.meshInfo[m].mesh.vertices = òo.meshInfo[m].vertices;
|
||||
öû.UpdateGeometry(òo.meshInfo[m].mesh, m);
|
||||
}
|
||||
}
|
||||
öû.UpdateVertexData(TMP_VertexDataUpdateFlags.Colors32);
|
||||
}
|
||||
|
||||
private void ë()
|
||||
{
|
||||
öæ.Clear();
|
||||
if (string.IsNullOrWhiteSpace(ForWords) || öí == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
StringBuilder stringBuilder = new StringBuilder(òo.characterCount);
|
||||
for (int i = 0; i < òo.characterCount; i++)
|
||||
{
|
||||
stringBuilder.Append(òo.characterInfo[i].character);
|
||||
}
|
||||
bool flag = (öû.fontStyle & (FontStyles.LowerCase | FontStyles.UpperCase | FontStyles.SmallCaps)) != 0;
|
||||
string text = stringBuilder.ToString();
|
||||
string[] array = ForWords.Split(new char[2] { '\t', ' ' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] array2 = array;
|
||||
foreach (string text2 in array2)
|
||||
{
|
||||
int startIndex = 0;
|
||||
while (true)
|
||||
{
|
||||
startIndex = text.IndexOf(text2, startIndex, flag ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal);
|
||||
if (startIndex == -1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (startIndex <= 0 || è(text[startIndex - 1]))
|
||||
{
|
||||
int num = startIndex + text2.Length;
|
||||
if (num >= text.Length || è(text[num]))
|
||||
{
|
||||
öæ.Add(new ValueTuple<int, int>(startIndex, startIndex + text2.Length - 1));
|
||||
}
|
||||
}
|
||||
startIndex += text2.Length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool è(char ï)
|
||||
{
|
||||
return char.IsWhiteSpace(ï) || char.IsSeparator(ï) || char.IsPunctuation(ï);
|
||||
}
|
||||
|
||||
private void î(TMP_TextInfo ì, TMP_CharacterInfo Ä, int Å, Color32[] É, Vector3[] æ, Vector3[] Æ, float û, float ù, ushort ÿ)
|
||||
{
|
||||
if (öÜ)
|
||||
{
|
||||
οο(Ä, Å, É, Ü(öú + Ä.index));
|
||||
}
|
||||
else
|
||||
{
|
||||
οο(Ä, Å, É, ù);
|
||||
}
|
||||
switch (Type)
|
||||
{
|
||||
case EffectType.Waves:
|
||||
οó(Ä, Å, æ, Æ, û);
|
||||
break;
|
||||
case EffectType.Grow:
|
||||
οë(Ä, Å, æ, Æ, ù);
|
||||
break;
|
||||
case EffectType.Unfold:
|
||||
οÅ(Ä, Å, æ, Æ, ù);
|
||||
break;
|
||||
case EffectType.UnfoldAndWaves:
|
||||
οÅ(Ä, Å, æ, Æ, ù);
|
||||
οó(Ä, Å, æ, æ, û);
|
||||
break;
|
||||
case EffectType.Sketch:
|
||||
á(Ä, Å, æ, Æ, ù, ÿ);
|
||||
break;
|
||||
case EffectType.Bounce:
|
||||
οâ(Ä, Å, æ, Æ, ù);
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
}
|
||||
|
||||
private float Ü(int ƒ)
|
||||
{
|
||||
int num = Mathf.Abs(ƒ % öñ.Length);
|
||||
return öñ[num];
|
||||
}
|
||||
|
||||
private void á(TMP_CharacterInfo í, int ú, Vector3[] ñ, Vector3[] Ñ, float ª, int οo)
|
||||
{
|
||||
Ö οá = default(Ö);
|
||||
οá.º = í;
|
||||
οá.Ç = this;
|
||||
ñ[ú] = Ñ[ú] - οÿ(ú, οo, ref οá);
|
||||
ñ[ú + 1] = Ñ[ú + 1] - οÿ(ú + 1, οo, ref οá);
|
||||
ñ[ú + 2] = Ñ[ú + 2] - οÿ(ú + 2, οo, ref οá);
|
||||
ñ[ú + 3] = Ñ[ú + 3] - οÿ(ú + 3, οo, ref οá);
|
||||
}
|
||||
|
||||
private void οο(TMP_CharacterInfo οо, int οô, Color32[] οö, float οò)
|
||||
{
|
||||
Color color = Gradient.Evaluate(οò);
|
||||
if (Mix == MixType.Multiply)
|
||||
{
|
||||
ref Color32 reference = ref οö[οô];
|
||||
reference *= color;
|
||||
ref Color32 reference2 = ref οö[οô + 1];
|
||||
reference2 *= color;
|
||||
ref Color32 reference3 = ref οö[οô + 2];
|
||||
reference3 *= color;
|
||||
ref Color32 reference4 = ref οö[οô + 3];
|
||||
reference4 *= color;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
Color color2 = οö[οô + i] + color;
|
||||
color2.a *= color.a;
|
||||
οö[οô + i] = color2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void οó(TMP_CharacterInfo οÖ, int οº, Vector3[] οÇ, Vector3[] οü, float οé)
|
||||
{
|
||||
ü οñ = default(ü);
|
||||
οñ.é = οé;
|
||||
οñ.â = οÖ;
|
||||
οñ.ä = this;
|
||||
οÇ[οº] = οü[οº] - οí(οº, ref οñ);
|
||||
οÇ[οº + 1] = οü[οº + 1] - οí(οº + 1, ref οñ);
|
||||
οÇ[οº + 2] = οü[οº + 2] - οí(οº + 2, ref οñ);
|
||||
οÇ[οº + 3] = οü[οº + 3] - οí(οº + 3, ref οñ);
|
||||
}
|
||||
|
||||
private void οâ(TMP_CharacterInfo οä, int οà, Vector3[] οå, Vector3[] οç, float οê)
|
||||
{
|
||||
à оo = default(à);
|
||||
оo.å = οê;
|
||||
оo.ç = οä;
|
||||
оo.ê = this;
|
||||
οå[οà] = οç[οà] - οÑ(οà, ref оo);
|
||||
οå[οà + 1] = οç[οà + 1] - οÑ(οà + 1, ref оo);
|
||||
οå[οà + 2] = οç[οà + 2] - οÑ(οà + 2, ref оo);
|
||||
οå[οà + 3] = οç[οà + 3] - οÑ(οà + 3, ref оo);
|
||||
}
|
||||
|
||||
private void οë(TMP_CharacterInfo οè, int οï, Vector3[] οî, Vector3[] οì, float οÄ)
|
||||
{
|
||||
οî[οï] = οì[οï];
|
||||
οî[οï + 3] = οì[οï + 3];
|
||||
οî[οï + 1] = Vector3.Lerp(οì[οï], οì[οï + 1], οÄ);
|
||||
οî[οï + 2] = Vector3.Lerp(οì[οï + 3], οì[οï + 2], οÄ);
|
||||
οî[οï] = Vector3.LerpUnclamped(οì[οï], οî[οï], Amplitude);
|
||||
οî[οï + 1] = Vector3.LerpUnclamped(οì[οï + 1], οî[οï + 1], Amplitude);
|
||||
οî[οï + 2] = Vector3.LerpUnclamped(οì[οï + 2], οî[οï + 2], Amplitude);
|
||||
οî[οï + 3] = Vector3.LerpUnclamped(οì[οï + 3], οî[οï + 3], Amplitude);
|
||||
}
|
||||
|
||||
private void οÅ(TMP_CharacterInfo οÉ, int οæ, Vector3[] οÆ, Vector3[] οû, float οù)
|
||||
{
|
||||
Vector3 a = (οû[οæ] + οû[οæ + 1]) * 0.5f;
|
||||
Vector3 a2 = (οû[οæ + 3] + οû[οæ + 2]) * 0.5f;
|
||||
οÆ[οæ] = Vector3.Lerp(a, οû[οæ], οù);
|
||||
οÆ[οæ + 3] = Vector3.Lerp(a2, οû[οæ + 3], οù);
|
||||
οÆ[οæ + 1] = Vector3.Lerp(a, οû[οæ + 1], οù);
|
||||
οÆ[οæ + 2] = Vector3.Lerp(a2, οû[οæ + 2], οù);
|
||||
οÆ[οæ] = Vector3.LerpUnclamped(οû[οæ], οÆ[οæ], Amplitude);
|
||||
οÆ[οæ + 1] = Vector3.LerpUnclamped(οû[οæ + 1], οÆ[οæ + 1], Amplitude);
|
||||
οÆ[οæ + 2] = Vector3.LerpUnclamped(οû[οæ + 2], οÆ[οæ + 2], Amplitude);
|
||||
οÆ[οæ + 3] = Vector3.LerpUnclamped(οû[οæ + 3], οÆ[οæ + 3], Amplitude);
|
||||
}
|
||||
|
||||
[ContextMenu("Play")]
|
||||
public void Play()
|
||||
{
|
||||
Apply();
|
||||
IsFinished = false;
|
||||
öÆ = Time.realtimeSinceStartup;
|
||||
öƒ = true;
|
||||
}
|
||||
|
||||
[ContextMenu("Finish")]
|
||||
public void Finish()
|
||||
{
|
||||
öÆ = float.MinValue;
|
||||
}
|
||||
|
||||
private Vector3 οÿ(int οÜ, int οƒ, ref Ö οá)
|
||||
{
|
||||
float num = οá.º.pointSize * 0.1f * Amplitude;
|
||||
float num2 = Ü(οÜ << οƒ);
|
||||
float num3 = Ü(οÜ << οƒ >> 5);
|
||||
return new Vector3(num2 * num, num3 * num, 0f);
|
||||
}
|
||||
|
||||
private Vector3 οí(int οú, ref ü οñ)
|
||||
{
|
||||
float f = MathF.PI * -2f * οñ.é + (float)(οú / 4) * 0.3f;
|
||||
return new Vector3(0f, Mathf.Cos(f) * οñ.â.pointSize * 0.3f * Amplitude, 0f);
|
||||
}
|
||||
|
||||
private Vector3 οÑ(int οª, ref à оo)
|
||||
{
|
||||
float f = MathF.PI * -2f * оo.å;
|
||||
return new Vector3(0f, Mathf.Cos(f) * оo.ç.pointSize * 0.3f * Amplitude, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
18
Assets/TextMesh Pro Effect/TextMeshProEffect.cs.meta
Normal file
18
Assets/TextMesh Pro Effect/TextMeshProEffect.cs.meta
Normal file
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f6f31fa26b868604483df4f19c00a991
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 156234
|
||||
packageName: TextMesh Pro Effect
|
||||
packageVersion: 1.63
|
||||
assetPath: Assets/TextMesh Pro Effect/TextMeshProEffect.cs
|
||||
uploadId: 755994
|
||||
Binary file not shown.
Reference in New Issue
Block a user