Added Unity assets and settings, including animation scripts, audio manager configuration, TextMesh Pro styles, and default volume profiles.
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
using System.Threading.Tasks;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Animations
|
||||
{
|
||||
public class AsyncTween : MonoBehaviour
|
||||
{
|
||||
private async void Start()
|
||||
{
|
||||
await Animate();
|
||||
|
||||
// transform.position = await AnimateTask(transform.forward);
|
||||
}
|
||||
|
||||
private async Task Animate()
|
||||
{
|
||||
float time = 0.0f;
|
||||
|
||||
while (time < 1.0f)
|
||||
{
|
||||
transform.position = Vector3.Lerp(Vector3.zero, transform.forward * 5.0f, time);
|
||||
transform.localScale = Vector3.Lerp(Vector3.one, Vector3.one * 2.0f, time);
|
||||
// await Task.Yield(); // wait for next frame
|
||||
await UniTask.DelayFrame(1); // wait for next frame
|
||||
time += Time.deltaTime;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<Vector3> AnimateTask(Vector3 forward)
|
||||
{
|
||||
float time = 0.0f;
|
||||
|
||||
Vector3 position = Vector3.zero;
|
||||
|
||||
while (time < 1.0f)
|
||||
{
|
||||
position = Vector3.Lerp(Vector3.zero, transform.forward * 5.0f, time);
|
||||
await Task.Yield(); // wait for next frame
|
||||
time += Time.deltaTime;
|
||||
}
|
||||
|
||||
return position;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user