74 lines
1.6 KiB
C#
74 lines
1.6 KiB
C#
using SHADE;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace SHADE_Scripting.UI
|
|
{
|
|
public class SingleScaleBounce: Script
|
|
{
|
|
[NonSerialized]
|
|
TweenThread thread;
|
|
|
|
[NonSerialized]
|
|
Vector3 defaultScale;
|
|
|
|
public float durationUp = 0.15f;
|
|
public float durationDown = 0.3f;
|
|
|
|
public float scaleSize = 1.2f;
|
|
|
|
[NonSerialized]
|
|
private bool scaleUp = false;
|
|
|
|
protected override void awake()
|
|
{
|
|
Transform trans = GetComponent<Transform>();
|
|
if(trans != null)
|
|
{
|
|
defaultScale = trans.LocalScale;
|
|
}
|
|
|
|
}
|
|
|
|
protected override void start()
|
|
{
|
|
thread = TweenManager.CreateTweenThread(0.0f,1.0f,1.0f,EASING_METHOD.EASE_IN_SINE);
|
|
}
|
|
|
|
|
|
protected override void update()
|
|
{
|
|
if(scaleUp)
|
|
{
|
|
if(thread.IsCompleted())
|
|
{
|
|
scaleUp = false;
|
|
thread.duration = durationDown;
|
|
thread.ResetInvert();
|
|
}
|
|
}
|
|
|
|
Transform trans = GetComponent<Transform>();
|
|
if(trans != null)
|
|
{
|
|
trans.LocalScale = defaultScale * thread.GetValue();
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
public void ScaleBounceOnce()
|
|
{
|
|
scaleUp = true;
|
|
thread.duration = durationUp;
|
|
thread.Reset(1.0f, scaleSize);
|
|
}
|
|
|
|
|
|
}
|
|
}
|