40 lines
830 B
C#
40 lines
830 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using SHADE;
|
|
|
|
|
|
namespace SHADE_Scripting.UI
|
|
{
|
|
public class FadeInOnActive: Script
|
|
{
|
|
[NonSerialized]
|
|
TweenThread thread;
|
|
|
|
|
|
protected override void start()
|
|
{
|
|
thread = TweenManager.CreateTweenThread(0.5f, 0.0f, 1.0f, EASING_METHOD.LINEAR);
|
|
thread.SetResetOnInactive(GameObject);
|
|
}
|
|
|
|
protected override void update()
|
|
{
|
|
if(thread != null)
|
|
{
|
|
Renderable renderable = GetComponent<Renderable>();
|
|
if(renderable)
|
|
{
|
|
renderable.Material.SetProperty<float>("data.alpha", thread.GetValue());
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|