[Assets] UI 애셋 및 TextMesh Pro 임포트

- Fantasy Warrior HUD 애셋 (Synty Studios)
- Interface Core 라이브러리
- TextMesh Pro 패키지
- UI_HealthBar 프리팹
This commit is contained in:
2026-03-10 15:59:20 +09:00
parent 2cc24188b3
commit a3e1315af2
5252 changed files with 1014002 additions and 0 deletions

View File

@@ -0,0 +1,73 @@
// Copyright (c) 2024 Synty Studios Limited. All rights reserved.
//
// Use of this software is subject to the terms and conditions of the Synty Studios End User Licence Agreement (EULA)
// available at: https://syntystore.com/pages/end-user-licence-agreement
//
// Sample scripts are included only as examples and are not intended as production-ready.
using System;
using UnityEngine;
namespace Synty.Interface.FantasyWarriorHUD.Samples
{
/// <summary>
/// A container class for Animator actions.
/// </summary>
[Serializable]
public class SampleAnimatorActionData
{
public enum AnimatorActionType
{
Trigger,
Bool,
Float,
Int
}
[Header("References")]
public Animator animator;
public AnimatorActionType type;
[Header("Parameters")]
public string parameterName;
public bool boolToggle;
public bool boolValue;
public float floatValue;
public int intValue;
public void Execute()
{
if (!animator)
{
return;
}
animator.gameObject.SetActive(true);
switch (type)
{
case AnimatorActionType.Trigger:
animator.SetTrigger(parameterName);
break;
case AnimatorActionType.Bool:
if (boolToggle)
{
bool currentValue = animator.GetBool(parameterName);
animator.SetBool(parameterName, !currentValue);
}
else
{
animator.SetBool(parameterName, boolValue);
}
break;
case AnimatorActionType.Float:
animator.SetFloat(parameterName, floatValue);
break;
case AnimatorActionType.Int:
animator.SetInteger(parameterName, intValue);
break;
}
}
}
}

View File

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

View File

@@ -0,0 +1,314 @@
// Copyright (c) 2025 Synty Studios Limited. All rights reserved.
//
// Use of this software is subject to the terms and conditions of the End User Licence Agreement (EULA)
// of the store at which you purchased this asset.
//
// Synty assets are available at:
// https://www.syntystore.com
// https://assetstore.unity.com/publishers/5217
// https://www.fab.com/sellers/Synty%20Studios
//
// Sample scripts are included only as examples and are not intended as production-ready.
using UnityEngine;
using UnityEngine.EventSystems;
#if ENABLE_INPUT_SYSTEM
using UnityEngine.InputSystem;
// compile errors?
using UnityEngine.InputSystem.UI;
// compile errors?
// if you are getting a compile error here you likely need to import the Input System package (com.unity.inputsystem) in the package manager or change the input setting in player settings back to 'Input Manager (Old)'
#endif
namespace Synty.Interface.FantasyWarriorHUD.Samples
{
public enum UnifiedKey
{
None,
// Letters
A, B, C, D, E, F, G, H, I, J, K, L, M,
N, O, P, Q, R, S, T, U, V, W, X, Y, Z,
// Digits
Digit0, Digit1, Digit2, Digit3, Digit4,
Digit5, Digit6, Digit7, Digit8, Digit9,
// Numpad
Numpad0, Numpad1, Numpad2, Numpad3, Numpad4,
Numpad5, Numpad6, Numpad7, Numpad8, Numpad9,
// Arrows
UpArrow, DownArrow, LeftArrow, RightArrow,
// Function Keys
F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12,
// Controls
Space, Enter, Tab, Backspace, Escape,
LeftShift, RightShift, LeftCtrl, RightCtrl, LeftAlt, RightAlt,
}
public static class UnifiedKeyConverter
{
#if ENABLE_LEGACY_INPUT_MANAGER
public static KeyCode? ToKeyCode(this UnifiedKey key)
{
switch (key)
{
case UnifiedKey.A: return KeyCode.A;
case UnifiedKey.B: return KeyCode.B;
case UnifiedKey.C: return KeyCode.C;
case UnifiedKey.D: return KeyCode.D;
case UnifiedKey.E: return KeyCode.E;
case UnifiedKey.F: return KeyCode.F;
case UnifiedKey.G: return KeyCode.G;
case UnifiedKey.H: return KeyCode.H;
case UnifiedKey.I: return KeyCode.I;
case UnifiedKey.J: return KeyCode.J;
case UnifiedKey.K: return KeyCode.K;
case UnifiedKey.L: return KeyCode.L;
case UnifiedKey.M: return KeyCode.M;
case UnifiedKey.N: return KeyCode.N;
case UnifiedKey.O: return KeyCode.O;
case UnifiedKey.P: return KeyCode.P;
case UnifiedKey.Q: return KeyCode.Q;
case UnifiedKey.R: return KeyCode.R;
case UnifiedKey.S: return KeyCode.S;
case UnifiedKey.T: return KeyCode.T;
case UnifiedKey.U: return KeyCode.U;
case UnifiedKey.V: return KeyCode.V;
case UnifiedKey.W: return KeyCode.W;
case UnifiedKey.X: return KeyCode.X;
case UnifiedKey.Y: return KeyCode.Y;
case UnifiedKey.Z: return KeyCode.Z;
case UnifiedKey.Digit0: return KeyCode.Alpha0;
case UnifiedKey.Digit1: return KeyCode.Alpha1;
case UnifiedKey.Digit2: return KeyCode.Alpha2;
case UnifiedKey.Digit3: return KeyCode.Alpha3;
case UnifiedKey.Digit4: return KeyCode.Alpha4;
case UnifiedKey.Digit5: return KeyCode.Alpha5;
case UnifiedKey.Digit6: return KeyCode.Alpha6;
case UnifiedKey.Digit7: return KeyCode.Alpha7;
case UnifiedKey.Digit8: return KeyCode.Alpha8;
case UnifiedKey.Digit9: return KeyCode.Alpha9;
case UnifiedKey.Numpad0: return KeyCode.Keypad0;
case UnifiedKey.Numpad1: return KeyCode.Keypad1;
case UnifiedKey.Numpad2: return KeyCode.Keypad2;
case UnifiedKey.Numpad3: return KeyCode.Keypad3;
case UnifiedKey.Numpad4: return KeyCode.Keypad4;
case UnifiedKey.Numpad5: return KeyCode.Keypad5;
case UnifiedKey.Numpad6: return KeyCode.Keypad6;
case UnifiedKey.Numpad7: return KeyCode.Keypad7;
case UnifiedKey.Numpad8: return KeyCode.Keypad8;
case UnifiedKey.Numpad9: return KeyCode.Keypad9;
case UnifiedKey.UpArrow: return KeyCode.UpArrow;
case UnifiedKey.DownArrow: return KeyCode.DownArrow;
case UnifiedKey.LeftArrow: return KeyCode.LeftArrow;
case UnifiedKey.RightArrow: return KeyCode.RightArrow;
case UnifiedKey.F1: return KeyCode.F1;
case UnifiedKey.F2: return KeyCode.F2;
case UnifiedKey.F3: return KeyCode.F3;
case UnifiedKey.F4: return KeyCode.F4;
case UnifiedKey.F5: return KeyCode.F5;
case UnifiedKey.F6: return KeyCode.F6;
case UnifiedKey.F7: return KeyCode.F7;
case UnifiedKey.F8: return KeyCode.F8;
case UnifiedKey.F9: return KeyCode.F9;
case UnifiedKey.F10: return KeyCode.F10;
case UnifiedKey.F11: return KeyCode.F11;
case UnifiedKey.F12: return KeyCode.F12;
case UnifiedKey.Space: return KeyCode.Space;
case UnifiedKey.Enter: return KeyCode.Return;
case UnifiedKey.Tab: return KeyCode.Tab;
case UnifiedKey.Backspace: return KeyCode.Backspace;
case UnifiedKey.Escape: return KeyCode.Escape;
case UnifiedKey.LeftShift: return KeyCode.LeftShift;
case UnifiedKey.RightShift: return KeyCode.RightShift;
case UnifiedKey.LeftCtrl: return KeyCode.LeftControl;
case UnifiedKey.RightCtrl: return KeyCode.RightControl;
case UnifiedKey.LeftAlt: return KeyCode.LeftAlt;
case UnifiedKey.RightAlt: return KeyCode.RightAlt;
default: return null;
}
}
#endif
#if ENABLE_INPUT_SYSTEM
public static Key? ToInputSystemKey(this UnifiedKey key)
{
switch (key)
{
case UnifiedKey.A: return Key.A;
case UnifiedKey.B: return Key.B;
case UnifiedKey.C: return Key.C;
case UnifiedKey.D: return Key.D;
case UnifiedKey.E: return Key.E;
case UnifiedKey.F: return Key.F;
case UnifiedKey.G: return Key.G;
case UnifiedKey.H: return Key.H;
case UnifiedKey.I: return Key.I;
case UnifiedKey.J: return Key.J;
case UnifiedKey.K: return Key.K;
case UnifiedKey.L: return Key.L;
case UnifiedKey.M: return Key.M;
case UnifiedKey.N: return Key.N;
case UnifiedKey.O: return Key.O;
case UnifiedKey.P: return Key.P;
case UnifiedKey.Q: return Key.Q;
case UnifiedKey.R: return Key.R;
case UnifiedKey.S: return Key.S;
case UnifiedKey.T: return Key.T;
case UnifiedKey.U: return Key.U;
case UnifiedKey.V: return Key.V;
case UnifiedKey.W: return Key.W;
case UnifiedKey.X: return Key.X;
case UnifiedKey.Y: return Key.Y;
case UnifiedKey.Z: return Key.Z;
case UnifiedKey.Digit0: return Key.Digit0;
case UnifiedKey.Digit1: return Key.Digit1;
case UnifiedKey.Digit2: return Key.Digit2;
case UnifiedKey.Digit3: return Key.Digit3;
case UnifiedKey.Digit4: return Key.Digit4;
case UnifiedKey.Digit5: return Key.Digit5;
case UnifiedKey.Digit6: return Key.Digit6;
case UnifiedKey.Digit7: return Key.Digit7;
case UnifiedKey.Digit8: return Key.Digit8;
case UnifiedKey.Digit9: return Key.Digit9;
case UnifiedKey.Numpad0: return Key.Numpad0;
case UnifiedKey.Numpad1: return Key.Numpad1;
case UnifiedKey.Numpad2: return Key.Numpad2;
case UnifiedKey.Numpad3: return Key.Numpad3;
case UnifiedKey.Numpad4: return Key.Numpad4;
case UnifiedKey.Numpad5: return Key.Numpad5;
case UnifiedKey.Numpad6: return Key.Numpad6;
case UnifiedKey.Numpad7: return Key.Numpad7;
case UnifiedKey.Numpad8: return Key.Numpad8;
case UnifiedKey.Numpad9: return Key.Numpad9;
case UnifiedKey.UpArrow: return Key.UpArrow;
case UnifiedKey.DownArrow: return Key.DownArrow;
case UnifiedKey.LeftArrow: return Key.LeftArrow;
case UnifiedKey.RightArrow: return Key.RightArrow;
case UnifiedKey.F1: return Key.F1;
case UnifiedKey.F2: return Key.F2;
case UnifiedKey.F3: return Key.F3;
case UnifiedKey.F4: return Key.F4;
case UnifiedKey.F5: return Key.F5;
case UnifiedKey.F6: return Key.F6;
case UnifiedKey.F7: return Key.F7;
case UnifiedKey.F8: return Key.F8;
case UnifiedKey.F9: return Key.F9;
case UnifiedKey.F10: return Key.F10;
case UnifiedKey.F11: return Key.F11;
case UnifiedKey.F12: return Key.F12;
case UnifiedKey.Space: return Key.Space;
case UnifiedKey.Enter: return Key.Enter;
case UnifiedKey.Tab: return Key.Tab;
case UnifiedKey.Backspace: return Key.Backspace;
case UnifiedKey.Escape: return Key.Escape;
case UnifiedKey.LeftShift: return Key.LeftShift;
case UnifiedKey.RightShift: return Key.RightShift;
case UnifiedKey.LeftCtrl: return Key.LeftCtrl;
case UnifiedKey.RightCtrl: return Key.RightCtrl;
case UnifiedKey.LeftAlt: return Key.LeftAlt;
case UnifiedKey.RightAlt: return Key.RightAlt;
default: return null;
}
}
#endif
}
public static class UnifiedInput
{
public static bool WasPressedThisFrame(UnifiedKey unifiedKey)
{
#if ENABLE_INPUT_SYSTEM
var key = unifiedKey.ToInputSystemKey();
if(key.HasValue) return Keyboard.current[key.Value].wasPressedThisFrame;
#elif ENABLE_LEGACY_INPUT_MANAGER
var keyCode = unifiedKey.ToKeyCode();
if(keyCode.HasValue) return Input.GetKeyDown(keyCode.Value);
#else
Debug.LogWarning("No input system enabled in project settings.");
#endif
return false;
}
public static bool IsPressed(UnifiedKey unifiedKey)
{
#if ENABLE_INPUT_SYSTEM
var key = unifiedKey.ToInputSystemKey();
if (key.HasValue) return Keyboard.current[key.Value].isPressed;
#elif ENABLE_LEGACY_INPUT_MANAGER
var keyCode = unifiedKey.ToKeyCode();
if(keyCode.HasValue) return Input.GetKey(keyCode.Value);
#else
Debug.LogWarning("No input system enabled in project settings.");
#endif
return false;
}
}
/// <summary>
/// Sample script that helps automatically select the correct input event module depending on your project's settings.
/// </summary>
[ExecuteAlways]
[RequireComponent(typeof(EventSystem))]
public class SampleAutoInputModule : MonoBehaviour
{
void OnEnable()
{
UpdateInputModule();
}
void UpdateInputModule()
{
#if ENABLE_INPUT_SYSTEM
// New Input System only
if (GetComponent<InputSystemUIInputModule>() == null)
{
// Remove any existing modules
foreach (var module in GetComponents<BaseInputModule>())
{
DestroyImmediate(module);
}
gameObject.AddComponent<InputSystemUIInputModule>();
if(!Application.isPlaying) Debug.Log("Added InputSystemUIInputModule (new input system)");
}
#elif ENABLE_LEGACY_INPUT_MANAGER
// Old Input Manager only
if (GetComponent<StandaloneInputModule>() == null)
{
// Remove any existing modules
foreach (var module in GetComponents<BaseInputModule>())
{
DestroyImmediate(module);
}
gameObject.AddComponent<StandaloneInputModule>();
if(!Application.isPlaying) Debug.Log("Added StandaloneInputModule (old input manager)");
}
#else
Debug.LogWarning("No input system enabled in project settings.");
#endif
}
}
}

View File

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

View File

@@ -0,0 +1,117 @@
// Copyright (c) 2024 Synty Studios Limited. All rights reserved.
//
// Use of this software is subject to the terms and conditions of the Synty Studios End User Licence Agreement (EULA)
// available at: https://syntystore.com/pages/end-user-licence-agreement
//
// Sample scripts are included only as examples and are not intended as production-ready.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace Synty.Interface.FantasyWarriorHUD.Samples
{
/// <summary>
/// Executes a list of animator actions and toggles a list of game objects on click.
/// </summary>
public class SampleButtonAction : MonoBehaviour
{
[Header("References")]
public Button button;
public List<GameObject> deactivateObjects;
public List<GameObject> toggleObjects;
public GameObject activateObject;
[Header("Parameters")]
public List<SampleAnimatorActionData> animatorActions;
public float activeTime = 1f;
public bool diableButtonWhenActive = false;
public bool runOnEnable;
public bool applyRandomRotationToActivateObject;
private void Awake()
{
if (button == null)
{
button = GetComponent<Button>();
}
if (button == null)
{
return;
}
button.onClick.AddListener(OnClick);
}
private void Reset()
{
button = GetComponent<Button>();
}
private void OnEnable()
{
if (runOnEnable)
{
OnClick();
}
}
private void OnClick()
{
foreach (GameObject deactivateObject in deactivateObjects)
{
if (deactivateObject != null)
{
deactivateObject.SetActive(false);
}
}
StopAllCoroutines();
StartCoroutine(C_ActivateObject());
foreach (GameObject toggleObject in toggleObjects)
{
if (toggleObject != null)
{
toggleObject.SetActive(!toggleObject.activeSelf);
}
}
foreach (SampleAnimatorActionData action in animatorActions)
{
action.Execute();
}
}
private IEnumerator C_ActivateObject()
{
if (diableButtonWhenActive && button != null)
{
button.interactable = false;
}
if (activateObject != null)
{
activateObject.SetActive(true);
if (applyRandomRotationToActivateObject)
{
activateObject.transform.localRotation = Quaternion.Euler(0, 0, Random.Range(0, 360));
}
}
yield return new WaitForSeconds(activeTime);
if (diableButtonWhenActive && button != null)
{
button.interactable = true;
}
if (activateObject != null)
{
activateObject.SetActive(false);
}
}
}
}

View File

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

View File

@@ -0,0 +1,90 @@
// Copyright (c) 2024 Synty Studios Limited. All rights reserved.
//
// Use of this software is subject to the terms and conditions of the Synty Studios End User Licence Agreement (EULA)
// available at: https://syntystore.com/pages/end-user-licence-agreement
//
// Sample scripts are included only as examples and are not intended as production-ready.
using System.Collections;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
namespace Synty.Interface.FantasyWarriorHUD.Samples
{
/// <summary>
/// A simple countdown label that counts down from a set time.
/// </summary>
public class SampleCountdownLabel : MonoBehaviour
{
[Header("References")]
public Animator animator;
public TMP_Text text;
[Header("Parameters")]
public bool setAnimatorActive = true;
public float initialDelay = 0;
public float countdownTime = 30;
public float updateInterval = 0.1f;
public float timeUpDuration = 2.5f;
public UnityEvent onCountdownComplete;
private float currentTime;
private void Reset()
{
text = GetComponentInChildren<TMP_Text>();
}
private IEnumerator Start()
{
yield return new WaitForSeconds(initialDelay);
BeginTimer();
}
private void BeginTimer()
{
currentTime = countdownTime;
RefreshUI();
StartCoroutine(C_TickDown());
}
private IEnumerator C_TickDown()
{
while (currentTime > 0)
{
yield return new WaitForSeconds(updateInterval);
currentTime -= updateInterval;
if (currentTime <= 0)
{
currentTime = 0;
}
RefreshUI();
}
if (setAnimatorActive)
animator?.gameObject.SetActive(true);
animator?.SetBool("Active", true);
yield return new WaitForSeconds(timeUpDuration);
animator?.SetBool("Active", false);
yield return new WaitForSeconds(1);
if (setAnimatorActive)
animator?.gameObject.SetActive(false);
onCountdownComplete?.Invoke();
BeginTimer();
}
private void RefreshUI()
{
if (text)
text.SetText(currentTime.ToString("F1"));
}
}
}

View File

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

View File

@@ -0,0 +1,78 @@
// Copyright (c) 2024 Synty Studios Limited. All rights reserved.
//
// Use of this software is subject to the terms and conditions of the Synty Studios End User Licence Agreement (EULA)
// available at: https://syntystore.com/pages/end-user-licence-agreement
//
// Sample scripts are included only as examples and are not intended as production-ready.
using System.Collections;
using UnityEngine;
namespace Synty.Interface.FantasyWarriorHUD.Samples
{
/// <summary>
/// A simple animator that loops between two values.
/// </summary>
public class SampleLoopAnimator : MonoBehaviour
{
[Header("References")]
public Animator animator;
[Header("Parameters")]
public string parameterName = "Health";
public float inSpeed = 5f;
public float outSpeed = 5f;
public float startDelay;
public float inDelay = 2.5f;
public float outDelay = 2.5f;
private void Awake()
{
if (animator == null)
{
animator = GetComponent<Animator>();
}
}
private void Reset()
{
animator = GetComponent<Animator>();
}
private void OnEnable()
{
if (animator == null)
{
return;
}
StartCoroutine(C_TweenBackAndForth());
}
private IEnumerator C_TweenBackAndForth()
{
yield return new WaitForSeconds(startDelay);
while (true)
{
yield return C_TweenFloat(0, 1, inSpeed);
yield return new WaitForSeconds(outDelay);
yield return C_TweenFloat(1, 0, outSpeed);
yield return new WaitForSeconds(inDelay);
}
}
private IEnumerator C_TweenFloat(float startValue, float endValue, float duration)
{
float time = 0f;
while (time < 1f)
{
time += Time.deltaTime / duration;
float currentValue = Mathf.Lerp(startValue, endValue, time);
animator.SetFloat(parameterName, currentValue);
yield return null;
}
}
}
}

View File

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

View File

@@ -0,0 +1,63 @@
// Copyright (c) 2024 Synty Studios Limited. All rights reserved.
//
// Use of this software is subject to the terms and conditions of the End User Licence Agreement (EULA)
// of the store at which you purchased this asset.
//
// Synty assets are available at:
// https://www.syntystore.com
// https://assetstore.unity.com/publishers/5217
// https://www.fab.com/sellers/Synty%20Studios
//
// Sample scripts are included only as examples and are not intended as production-ready.
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
namespace Synty.Interface.FantasyWarriorHUD.Samples
{
/// <summary>
/// Oscillates the value of a list of sliders.
/// </summary>
public class SampleOscillateSliders : MonoBehaviour
{
[Header("References")]
public List<Slider> sliders;
[Header("Parameters")]
public bool autoGetSliders = true;
public float speed = 1f;
public float offset = 0.5f;
private void GetSliders()
{
#if UNITY_2022_1_OR_NEWER
sliders = FindObjectsByType<Slider>(FindObjectsInactive.Exclude, FindObjectsSortMode.None).ToList();
#else
sliders = FindObjectsOfType<Slider>().ToList();
#endif
}
private void Reset()
{
GetSliders();
}
private void Start()
{
if (autoGetSliders)
{
GetSliders();
}
}
private void Update()
{
for (int i = 0; i < sliders.Count; i++)
{
sliders[i].value = (Mathf.Sin((Time.time * speed) + (i * offset)) * 0.5f) + 0.5f;
}
}
}
}

View File

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

View File

@@ -0,0 +1,86 @@
// Copyright (c) 2024 Synty Studios Limited. All rights reserved.
//
// Use of this software is subject to the terms and conditions of the Synty Studios End User Licence Agreement (EULA)
// available at: https://syntystore.com/pages/end-user-licence-agreement
//
// Sample scripts are included only as examples and are not intended as production-ready.
using System.Collections;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
namespace Synty.Interface.FantasyWarriorHUD.Samples
{
/// <summary>
/// A simple radial fill bar that fills and empties.
/// </summary>
public class SampleRadialFillBar : MonoBehaviour
{
[Header("References")]
public Image image;
public TMP_Text text;
[Header("Parameters")]
public float fillAmountFull = 1f;
public float inSpeed = 5f;
public float outSpeed = 5f;
public float startDelay;
public float inDelay = 2.5f;
public float outDelay = 2.5f;
public string labelText = "{0}%";
public string LabelText => string.Format(labelText, (image.fillAmount / fillAmountFull * 100f).ToString("0"));
private void Awake()
{
if (image == null)
{
image = GetComponentInChildren<Image>();
}
if (text == null)
{
text = GetComponentInChildren<TMP_Text>();
}
}
private void Reset()
{
image = GetComponentInChildren<Image>();
text = GetComponentInChildren<TMP_Text>();
}
private void Start()
{
StartCoroutine(C_TweenBackAndForth());
}
private IEnumerator C_TweenBackAndForth()
{
yield return new WaitForSeconds(startDelay);
while (true)
{
yield return C_TweenFloat(0, 1, inSpeed);
yield return new WaitForSeconds(outDelay);
yield return C_TweenFloat(1, 0, outSpeed);
yield return new WaitForSeconds(inDelay);
}
}
private IEnumerator C_TweenFloat(float startValue, float endValue, float duration)
{
float time = 0f;
while (time < 1f)
{
time += Time.deltaTime / duration;
float currentValue = Mathf.Lerp(startValue, endValue, time);
image.fillAmount = currentValue * fillAmountFull;
text?.SetText(LabelText);
yield return null;
}
}
}
}

View File

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

View File

@@ -0,0 +1,134 @@
// Copyright (c) 2024 Synty Studios Limited. All rights reserved.
//
// Use of this software is subject to the terms and conditions of the End User Licence Agreement (EULA)
// of the store at which you purchased this asset.
//
// Synty assets are available at:
// https://www.syntystore.com
// https://assetstore.unity.com/publishers/5217
// https://www.fab.com/sellers/Synty%20Studios
//
// Sample scripts are included only as examples and are not intended as production-ready.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.SceneManagement;
#if UNITY_EDITOR
using System.IO;
using UnityEditor;
using UnityEditor.SceneManagement;
#endif
namespace Synty.Interface.FantasyWarriorHUD.Samples
{
/// <summary>
/// A simple scene loader that transitions between screens.
/// </summary>
public class SampleSceneLoader : MonoBehaviour
{
[Header("References")]
public Animator animator;
[Header("Parameters")]
public bool showCursor;
[SerializeField]
private List<string> _sceneNames;
#if UNITY_EDITOR
private void RefreshScenes()
{
MonoScript script = MonoScript.FromMonoBehaviour(this);
string samplesPath = Path.GetDirectoryName(Path.GetDirectoryName(AssetDatabase.GetAssetPath(script)));
string[] searchPaths = { Path.Combine(samplesPath, "Scenes") };
_sceneNames = AssetDatabase.FindAssets($"t:scene", searchPaths)
.Select(guid => Path.GetFileNameWithoutExtension(AssetDatabase.GUIDToAssetPath(guid)))
.ToList();
EditorUtility.SetDirty(this);
}
private void OnValidate()
{
RefreshScenes();
}
#endif
private void OnEnable()
{
if (animator)
{
animator.gameObject.SetActive(true);
animator.SetBool("Active", false);
}
if (showCursor)
{
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
}
}
public void QuitApplication()
{
#if UNITY_EDITOR
EditorApplication.isPlaying = false;
#else
Application.Quit();
#endif
}
public void NextScene()
{
string currentScene = SceneManager.GetActiveScene().name;
SwitchScene(_sceneNames[(_sceneNames.IndexOf(currentScene) + 1) % _sceneNames.Count]);
}
public void PreviousScene()
{
string currentScene = SceneManager.GetActiveScene().name;
SwitchScene(_sceneNames[(_sceneNames.IndexOf(currentScene) - 1 + _sceneNames.Count) % _sceneNames.Count]);
}
public void SwitchScene(string sceneName)
{
#if UNITY_EDITOR
if (!EditorApplication.isPlaying)
{
return;
}
#endif
StartCoroutine(C_SwitchScene(sceneName));
}
private IEnumerator C_SwitchScene(string sceneName)
{
if (animator)
{
animator.gameObject.SetActive(true);
animator.SetBool("Active", true);
yield return new WaitForSeconds(0.5f);
}
#if UNITY_EDITOR
string path = sceneName;
if (path.IndexOf('/') == -1)
{
string guid = AssetDatabase.FindAssets($"{sceneName} t:scene")[0];
path = AssetDatabase.GUIDToAssetPath(guid);
}
yield return EditorSceneManager.LoadSceneAsyncInPlayMode(path, new LoadSceneParameters(LoadSceneMode.Single));
#else
// make sure the scene is in the build settings for runtime version
AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(sceneName);
while (!asyncLoad.isDone)
{
yield return null;
}
#endif
}
}
}

View File

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

View File

@@ -0,0 +1,50 @@
// Copyright (c) 2024 Synty Studios Limited. All rights reserved.
//
// Use of this software is subject to the terms and conditions of the Synty Studios End User Licence Agreement (EULA)
// available at: https://syntystore.com/pages/end-user-licence-agreement
//
// Sample scripts are included only as examples and are not intended as production-ready.
using UnityEngine;
using UnityEngine.UI;
namespace Synty.Interface.FantasyWarriorHUD.Samples
{
/// <summary>
/// Animates the UVs of a raw image for a scrolling background effect.
/// </summary>
public class SampleScrollUV : MonoBehaviour
{
[Header("References")]
public RawImage rawImage;
[Header("Parameters")]
public Vector2 speed = new Vector2(1, 0);
public Vector2 size = new Vector2(256, 256);
private void Awake()
{
if (rawImage == null)
{
rawImage = GetComponent<RawImage>();
}
}
private void Reset()
{
rawImage = GetComponent<RawImage>();
}
private void Update()
{
Vector2 calculatedSizeBasedOnScreen = new Vector2(
rawImage.rectTransform.rect.width / size.x,
rawImage.rectTransform.rect.height / size.y
);
rawImage.uvRect = new Rect(
rawImage.uvRect.position + (speed * Time.deltaTime),
calculatedSizeBasedOnScreen
);
}
}
}

View File

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

View File

@@ -0,0 +1,78 @@
// Copyright (c) 2024 Synty Studios Limited. All rights reserved.
//
// Use of this software is subject to the terms and conditions of the Synty Studios End User Licence Agreement (EULA)
// available at: https://syntystore.com/pages/end-user-licence-agreement
//
// Sample scripts are included only as examples and are not intended as production-ready.
using System;
using System.Collections;
using TMPro;
using UnityEngine;
namespace Synty.Interface.FantasyWarriorHUD.Samples
{
/// <summary>
/// A simple time label that displays the current time.
/// </summary>
public class SampleTimeLabel : MonoBehaviour
{
[Header("References")]
public TMP_Text label;
[Header("Parameters")]
public bool is24Hour = true;
public float timeToRefreshInSeconds = 1;
private bool beat;
private void Awake()
{
if (label == null)
{
label = GetComponent<TMP_Text>();
}
}
private void OnEnable()
{
StartCoroutine(C_UpdateTime());
}
private void OnDisable()
{
StopCoroutine(C_UpdateTime());
}
public string GetCurrentTimeString()
{
if (!is24Hour)
{
return DateTime.Now.ToString("hh:mm tt");
}
if (beat)
{
return DateTime.Now.ToString("HH<color=#AAAAAA>:</color>mm");
}
return DateTime.Now.ToString("HH:mm");
}
[ContextMenu("Update Time")]
public void UpdateTime()
{
label.SetText(GetCurrentTimeString());
}
private IEnumerator C_UpdateTime()
{
while (true)
{
UpdateTime();
beat = !beat;
yield return new WaitForSecondsRealtime(timeToRefreshInSeconds);
}
}
}
}

View File

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

View File

@@ -0,0 +1,27 @@
// Copyright (c) 2024 Synty Studios Limited. All rights reserved.
//
// Use of this software is subject to the terms and conditions of the End User Licence Agreement (EULA)
// of the store at which you purchased this asset.
//
// Synty assets are available at:
// https://www.syntystore.com
// https://assetstore.unity.com/publishers/5217
// https://www.fab.com/sellers/Synty%20Studios
//
// Sample scripts are included only as examples and are not intended as production-ready.
using UnityEngine;
namespace Synty.Interface.FantasyWarriorHUD.Samples
{
/// <summary>
/// Opens a URL in the default browser.
/// </summary>
public class SampleURL : MonoBehaviour
{
public void OpenURL(string url)
{
Application.OpenURL(url);
}
}
}

View File

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

View File

@@ -0,0 +1,105 @@
// Copyright (c) 2024 Synty Studios Limited. All rights reserved.
//
// Use of this software is subject to the terms and conditions of the Synty Studios End User Licence Agreement (EULA)
// available at: https://syntystore.com/pages/end-user-licence-agreement
//
// Sample scripts are included only as examples and are not intended as production-ready.
using System.Collections.Generic;
using System.Linq;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
namespace Synty.Interface.FantasyWarriorHUD.Samples
{
/// <summary>
/// A simple XP bar that displays the current XP and level and continually levels-up indefinitely.
/// </summary>
public class SampleXPBar : MonoBehaviour
{
[Header("References")]
public Animator animator;
public Slider xpSlider;
public TMP_Text xpText;
public TMP_Text levelText;
[Header("Parameters")]
public int xpPerLevelUp = 1000;
private int currentLevel;
private float currentXPNormalized;
private float secondsPerLevelUp;
private void Awake()
{
// Set random starting values.
currentLevel = Random.Range(1, 69);
currentXPNormalized = 0;
secondsPerLevelUp = Random.Range(4, 20f);
}
private void Reset()
{
List<RectTransform> children = new List<RectTransform>();
foreach (Transform child in transform)
{
if (child is RectTransform)
{
children.Add(child as RectTransform);
}
}
RectTransform xpObj = children.SingleOrDefault(c => c.name.ToLower().Contains("xp"));
if (xpObj)
{
xpSlider = xpObj.GetComponentInChildren<Slider>();
xpText = xpObj.transform.GetComponentInChildren<TMP_Text>();
}
RectTransform lvlObj = children.SingleOrDefault(c => c.name.ToLower().Contains("level"));
if (lvlObj)
{
levelText = lvlObj.GetComponentInChildren<TMP_Text>();
}
}
private void Update()
{
// Update the XP bar.
if (xpSlider)
{
xpSlider.value = currentXPNormalized;
}
if (xpText)
{
xpText.text = $"{Mathf.RoundToInt(currentXPNormalized * xpPerLevelUp)}/{xpPerLevelUp}";
}
if (levelText)
{
levelText.text = $"{currentLevel}";
}
// If we have enough XP to level up, do so.
if (currentXPNormalized >= 1f)
{
// LEVEL UP!
currentLevel++;
currentXPNormalized = 0;
// Animate level up.
if (animator)
{
animator.SetTrigger("LevelUp");
}
}
// Add XP based on time.
currentXPNormalized += Time.deltaTime / secondsPerLevelUp;
}
}
}

View File

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