架构大更
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AllIn1VfxToolkit.DemoAssets.TexturesDemo.Scripts
|
||||
{
|
||||
@@ -8,9 +7,9 @@ namespace AllIn1VfxToolkit.DemoAssets.TexturesDemo.Scripts
|
||||
[SerializeField] private float maxTweenScale = 2.0f;
|
||||
[SerializeField] private float minTweenScale = 0.8f;
|
||||
[SerializeField] private float tweenSpeed = 15f;
|
||||
|
||||
private bool isTweening = false;
|
||||
private float currentScale = 1f, iniScale;
|
||||
|
||||
private bool isTweening;
|
||||
private Vector3 scaleToApply = Vector3.one;
|
||||
|
||||
private void Start()
|
||||
@@ -20,11 +19,11 @@ namespace AllIn1VfxToolkit.DemoAssets.TexturesDemo.Scripts
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if(!isTweening) return;
|
||||
if (!isTweening) return;
|
||||
currentScale = Mathf.Lerp(currentScale, iniScale, Time.unscaledDeltaTime * tweenSpeed);
|
||||
UpdateScaleToApply();
|
||||
ApplyScale();
|
||||
if(Mathf.Abs(currentScale - 1f) < 0.02f) isTweening = false;
|
||||
if (Mathf.Abs(currentScale - 1f) < 0.02f) isTweening = false;
|
||||
}
|
||||
|
||||
private void UpdateScaleToApply()
|
||||
@@ -32,7 +31,7 @@ namespace AllIn1VfxToolkit.DemoAssets.TexturesDemo.Scripts
|
||||
scaleToApply.x = currentScale;
|
||||
scaleToApply.y = currentScale;
|
||||
}
|
||||
|
||||
|
||||
private void ApplyScale()
|
||||
{
|
||||
transform.localScale = scaleToApply;
|
||||
@@ -44,7 +43,7 @@ namespace AllIn1VfxToolkit.DemoAssets.TexturesDemo.Scripts
|
||||
currentScale = iniScale * maxTweenScale;
|
||||
UpdateScaleToApply();
|
||||
}
|
||||
|
||||
|
||||
public void ScaleDownTween()
|
||||
{
|
||||
isTweening = true;
|
||||
|
||||
Reference in New Issue
Block a user