[Assets] UI 애셋 및 TextMesh Pro 임포트
- Fantasy Warrior HUD 애셋 (Synty Studios) - Interface Core 라이브러리 - TextMesh Pro 패키지 - UI_HealthBar 프리팹
This commit is contained in:
63
Assets/External/InterfaceFantasyWarriorHUD/Samples/Scripts/SampleOscillateSliders.cs
vendored
Normal file
63
Assets/External/InterfaceFantasyWarriorHUD/Samples/Scripts/SampleOscillateSliders.cs
vendored
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user