92 lines
2.4 KiB
C#
92 lines
2.4 KiB
C#
using SHADE;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
public class LevelTransistion : Script
|
|
{
|
|
|
|
public GameObject logo;
|
|
public GameObject bg;
|
|
public float duration = 2.0f;
|
|
public float bgEndPositionX = 2500;
|
|
public float logoEndPositionX = 2500;
|
|
|
|
public bool rotAndScale = true;
|
|
public float rotationAmt = 360;
|
|
public float scaleAmt = 631;
|
|
|
|
public bool complete { get; set; }
|
|
|
|
private Transform logoTran;
|
|
private Transform bgTran;
|
|
|
|
private TweenThread bgTween;
|
|
private TweenThread logoTween;
|
|
private TweenThread rot;
|
|
private TweenThread scale;
|
|
|
|
protected override void awake()
|
|
{
|
|
logoTran = logo.GetComponent<Transform>();
|
|
if (!logoTran)
|
|
Debug.LogError("MISSING LOGO TRAN");
|
|
|
|
bgTran = bg.GetComponent<Transform>();
|
|
if (!bgTran)
|
|
Debug.LogError("MISSING BG TRAN");
|
|
|
|
complete = false;
|
|
}
|
|
|
|
protected override void start()
|
|
{
|
|
bgTween = TweenManager.CreateTweenThread(duration, bgTran.LocalPosition.x, bgEndPositionX, EASING_METHOD.EASE_OUT_CIRCLE);
|
|
logoTween = TweenManager.CreateTweenThread(duration , logoTran.LocalPosition.x, logoEndPositionX, EASING_METHOD.EASE_OUT_CIRCLE);
|
|
rot = TweenManager.CreateTweenThread(duration , 0, rotationAmt, EASING_METHOD.EASE_OUT_BACK);
|
|
scale = TweenManager.CreateTweenThread(duration, 0, scaleAmt, EASING_METHOD.EASE_OUT_BACK);
|
|
}
|
|
|
|
protected override void update()
|
|
{
|
|
if (bgTween != null)
|
|
bgTran.LocalPosition = new Vector3(bgTween.GetValue(), 0, bgTran.LocalPosition.z);
|
|
|
|
if (rotAndScale)
|
|
{
|
|
logoTran.LocalScale = new Vector3(scale.GetValue(), scale.GetValue(), 1);
|
|
logoTran.LocalEulerAngles = new Vector3(0, 0, SHADE.Math.DegreesToRadians(rot.GetValue()));
|
|
}
|
|
else
|
|
{
|
|
logoTran.LocalPosition = new Vector3(logoTween.GetValue(), 0, logoTran.LocalPosition.z);
|
|
}
|
|
|
|
if (bgTween.IsCompleted() && logoTween.IsCompleted())
|
|
complete = true;
|
|
}
|
|
|
|
public void resetToLeft()
|
|
{
|
|
logoTran.LocalEulerAngles = Vector3.Zero;
|
|
logoTran.LocalPosition = Vector3.Zero;
|
|
logoTran.LocalScale = Vector3.Zero;
|
|
bgTween.duration = 0.8f;
|
|
bgTween.Reset(-3000.0f,0.0f);
|
|
logoTween.duration = 0.8f;
|
|
logoTween.Reset();
|
|
rot.duration = 0.8f;
|
|
rot.Reset();
|
|
scale.duration = 0.8f;
|
|
scale.Reset();
|
|
complete = false;
|
|
rotAndScale = true;
|
|
}
|
|
|
|
|
|
}
|
|
|