add unity multithreading project
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
public class UpdateTween : MonoBehaviour
|
||||
{
|
||||
private bool _isMoving = true;
|
||||
private bool _isAnimating = true;
|
||||
private float _time = 0.0f;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (_isAnimating)
|
||||
{
|
||||
if (_isMoving)
|
||||
{
|
||||
// move
|
||||
// transform.position += Vector3.forward * Time.deltaTime;
|
||||
// transform.position = Vector3.Lerp(Vector3.zero, Vector3.forward * 5.0f, Time.deltaTime);
|
||||
transform.position = Vector3.Lerp(Vector3.zero, Vector3.forward * 5.0f, _time);
|
||||
_time += Time.deltaTime;
|
||||
|
||||
if (_time >= 1.0f)
|
||||
{
|
||||
_time = 0.0f;
|
||||
_isMoving = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// scale
|
||||
transform.localScale = Vector3.Lerp(Vector3.one, Vector3.one * 2.0f, _time);
|
||||
_time += Time.deltaTime;
|
||||
|
||||
if (_time >= 1.0f)
|
||||
{
|
||||
_time = 0.0f;
|
||||
_isAnimating = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user