mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 06:19:22 +00:00
[PropLoadingHexagon] Initial release
This commit is contained in:
parent
4307d85329
commit
a5e5b05ab8
11 changed files with 372 additions and 325 deletions
37
PropLoadingHexagon/Components/LoadingHexagonController.cs
Normal file
37
PropLoadingHexagon/Components/LoadingHexagonController.cs
Normal file
|
@ -0,0 +1,37 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace NAK.PropLoadingHexagon.Components;
|
||||
|
||||
public class LoadingHexagonController : MonoBehaviour
|
||||
{
|
||||
public bool IsLoadingCanceled { get; set; }
|
||||
|
||||
[SerializeField] private SkinnedMeshRenderer _hexRenderer;
|
||||
[SerializeField] private TMPro.TextMeshPro _loadingText;
|
||||
[SerializeField] private Transform[] _hexTransforms;
|
||||
private float _scale;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (_scale < 1f)
|
||||
{
|
||||
_scale += Time.deltaTime * 4f;
|
||||
transform.GetChild(0).localScale = Vector3.one * _scale;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
// give slightly different rotation to each hexagon
|
||||
_hexTransforms[i].Rotate(Vector3.up, 30f * Time.deltaTime * (i + 1));
|
||||
}
|
||||
}
|
||||
|
||||
public void SetLoadingText(string text)
|
||||
{
|
||||
if (_loadingText.text == text) return;
|
||||
_loadingText.text = text;
|
||||
}
|
||||
|
||||
public void SetLoadingShape(float value)
|
||||
=> _hexRenderer.SetBlendShapeWeight(0, value);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue