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,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b764331771a04d41b08d9c42da4a2d47
|
||||
timeCreated: 1783956711
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: abf2570720504374bfa8ee9b9155bf60
|
||||
timeCreated: 1783958685
|
||||
@@ -0,0 +1,30 @@
|
||||
using System.Collections;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Animations
|
||||
{
|
||||
public class CoroutineTween : MonoBehaviour
|
||||
{
|
||||
private async void Start()
|
||||
{
|
||||
// StartCoroutine(Animate());
|
||||
|
||||
// with UniTask
|
||||
await Animate();
|
||||
}
|
||||
|
||||
private IEnumerator 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);
|
||||
yield return null; // wait for next frame
|
||||
time += Time.deltaTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6d5cb1ff3fda74e6e88dfb6e627a02be
|
||||
@@ -0,0 +1,19 @@
|
||||
using DefaultNamespace;
|
||||
using PrimeTween;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Animations
|
||||
{
|
||||
public class PrimeTween : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Enemy _enemy;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
Tween.PositionZ(transform, 5.0f, 1.0f);
|
||||
Tween.Scale(transform, 2.0f, 1.0f);
|
||||
|
||||
// Tween.Custom(0.0f, 1.0f, 5.0f, f => _enemy.Acceleration = f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b28efd45972540a08b0c181e7dfc49d1
|
||||
timeCreated: 1783959807
|
||||
@@ -0,0 +1,48 @@
|
||||
using System.Collections;
|
||||
using System.Threading;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Animations
|
||||
{
|
||||
public class ThreadTween : MonoBehaviour
|
||||
{
|
||||
private void Start()
|
||||
{
|
||||
StartCoroutine(StartThread());
|
||||
}
|
||||
|
||||
private IEnumerator StartThread()
|
||||
{
|
||||
yield return new WaitForSeconds(2.0f);
|
||||
|
||||
// CAUTION: you can't access Unity Objects, e.g. Transforms, from another thread
|
||||
// than the main thread
|
||||
|
||||
// CAUTION: never put the main thread to sleep, e.g. Thread.Sleep() or Thread.Join()
|
||||
|
||||
Vector3 position = transform.position;
|
||||
Vector3 forward = transform.forward;
|
||||
Vector3 localScale = transform.localScale;
|
||||
|
||||
Thread thread = new Thread(() =>
|
||||
{
|
||||
float time = 0.0f;
|
||||
|
||||
while (time < 1.0f)
|
||||
{
|
||||
position = Vector3.Lerp(Vector3.zero, forward * 5.0f, time);
|
||||
localScale = Vector3.Lerp(Vector3.one, Vector3.one * 2.0f, time);
|
||||
Thread.Sleep(16);
|
||||
// time += Time.deltaTime; // Time is not available in a thread
|
||||
time += 0.016f;
|
||||
}
|
||||
});
|
||||
thread.Start();
|
||||
|
||||
thread.Join();
|
||||
|
||||
transform.position = position;
|
||||
transform.localScale = localScale;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ce7b5f41be0241d398373d5f9ca1352e
|
||||
timeCreated: 1783957554
|
||||
@@ -0,0 +1,21 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Animations
|
||||
{
|
||||
public class UpdateTween : MonoBehaviour
|
||||
{
|
||||
private bool _isAnimating = true;
|
||||
private float _animationTime = 0f;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (!_isAnimating) return;
|
||||
|
||||
transform.position = Vector3.Lerp(Vector3.zero, transform.forward * 5.0f, _animationTime);
|
||||
transform.localScale = Vector3.Lerp(Vector3.one, Vector3.one * 2.0f, _animationTime);
|
||||
_animationTime += Time.deltaTime;
|
||||
|
||||
if (_animationTime >= 1.0f) _isAnimating = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 034e00625db44d8bbe5e8d3dbbf3c789
|
||||
timeCreated: 1783956721
|
||||
@@ -0,0 +1,17 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace DefaultNamespace
|
||||
{
|
||||
public class Enemy : MonoBehaviour
|
||||
{
|
||||
private float _speed = 0.0f;
|
||||
|
||||
public float Acceleration { get; set; } = 0.0f;
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
_speed += Acceleration * Time.fixedDeltaTime;
|
||||
transform.position += transform.forward * _speed * Time.fixedDeltaTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 195fae0cdcf34b719953a19ac80a6de9
|
||||
timeCreated: 1783960119
|
||||
@@ -0,0 +1,21 @@
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DefaultNamespace
|
||||
{
|
||||
[RequireComponent(typeof(TextMeshProUGUI))]
|
||||
public class TimeLabel : MonoBehaviour
|
||||
{
|
||||
private TextMeshProUGUI _text;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_text = GetComponent<TextMeshProUGUI>();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
_text.text = Time.time.ToString("0.00");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d50cc37b06be4c7b931a795c2c2ef891
|
||||
timeCreated: 1783957994
|
||||
Reference in New Issue
Block a user