116 lines
3.1 KiB
C#
116 lines
3.1 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.SceneManagement;
|
|
using DG.Tweening;
|
|
using UnityEngine.EventSystems;
|
|
|
|
public class Start_UI : MonoBehaviour
|
|
{
|
|
public AnimationCurve scaleCurve;
|
|
|
|
Transform kuang;
|
|
Vector3 str_kuang_pos;
|
|
Vector3 end_kuang_pos;
|
|
|
|
Transform AppName;
|
|
Vector3 str_AppName;
|
|
Vector3 end_AppName;
|
|
|
|
Transform di;
|
|
Vector3 str_di_pos;
|
|
Vector3 end_di_pos;
|
|
|
|
private void Awake()
|
|
{
|
|
kuang = transform.Find("kuang");
|
|
AppName = transform.Find("AppName");
|
|
di = transform.Find("di");
|
|
|
|
str_kuang_pos = new Vector3(-2, 347, 0);
|
|
str_AppName = str_kuang_pos;
|
|
end_kuang_pos = kuang.localPosition;
|
|
end_AppName = AppName.localPosition;
|
|
|
|
kuang.localPosition = str_kuang_pos;
|
|
AppName.localPosition = str_AppName;
|
|
|
|
str_di_pos = new Vector3(0, -846, 0);
|
|
end_di_pos = di.localPosition;
|
|
di.localPosition = str_di_pos;
|
|
}
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
StartCoroutine(SwitchoverScenes());
|
|
|
|
}
|
|
public float GetScale(float v)
|
|
{
|
|
return scaleCurve.Evaluate(v);
|
|
}
|
|
|
|
void scale_appname()
|
|
{
|
|
AppName.localScale = new Vector3(GetScale(Time.time), GetScale(Time.time), GetScale(Time.time));
|
|
//yield return 1;
|
|
}
|
|
IEnumerator BeginScenes()
|
|
{
|
|
InvokeRepeating("scale_appname", 0, 0.01f);
|
|
kuang.DOLocalMove(end_kuang_pos, 1);
|
|
AppName.DOLocalMove(end_AppName, 1);
|
|
yield return new WaitForSeconds(1f);
|
|
for (int i = 0; i < 5; i++)
|
|
{
|
|
if (i==0)
|
|
{
|
|
AppName.DOLocalRotate(Vector3.forward * 4, 0.05f);
|
|
yield return new WaitForSeconds(0.05f);
|
|
}
|
|
else if (i==4)
|
|
{
|
|
AppName.DOLocalRotate(Vector3.zero, 0.05f);
|
|
yield return new WaitForSeconds(0.05f);
|
|
}
|
|
else
|
|
{
|
|
if (AppName.localRotation.z>0)
|
|
{
|
|
AppName.DOLocalRotate(-Vector3.forward * 4, 0.1f);
|
|
yield return new WaitForSeconds(0.1f);
|
|
}
|
|
else
|
|
{
|
|
AppName.DOLocalRotate(Vector3.forward * 4, 0.1f);
|
|
yield return new WaitForSeconds(0.1f);
|
|
}
|
|
|
|
}
|
|
}
|
|
yield return new WaitUntil(() => (GetScale(Time.time) == 1));
|
|
di.DOLocalMove(end_di_pos, 1);
|
|
yield return new WaitForSeconds(1f);
|
|
}
|
|
|
|
IEnumerator SwitchoverScenes()
|
|
{
|
|
yield return StartCoroutine(BeginScenes());
|
|
gameObject.AddComponent<PassAnimation>();
|
|
for (int i = 0; i < transform.childCount; i++)
|
|
{
|
|
transform.GetChild(i).gameObject.AddComponent<PassAnimation>();
|
|
}
|
|
yield return new WaitForSeconds(0.8f);
|
|
SceneManager.LoadScene("EndScene");
|
|
Debug.Log("可以跳转2");
|
|
}
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
|
|
|
|
}
|