You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
83 lines
1.5 KiB
83 lines
1.5 KiB
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using UnityEngine.SceneManagement;
|
|
public class UIGradient : MonoBehaviour
|
|
{
|
|
public Image image;
|
|
public List<Sprite> spriteList;
|
|
public int SpriteInt;
|
|
public Text text;
|
|
public string strtext;
|
|
void Start()
|
|
{
|
|
InvokeRepeating("OpenHandoff", 2, 3);
|
|
StartCoroutine(Typewriter());
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
IEnumerator Typewriter()
|
|
{
|
|
foreach (var item in strtext.ToCharArray())
|
|
{
|
|
text.text += item;
|
|
yield return new WaitForSeconds(0.1f);
|
|
}
|
|
|
|
yield return new WaitForSeconds(2f);
|
|
SceneManager.LoadScene("office_Two");
|
|
|
|
}
|
|
|
|
public void OpenHandoff()
|
|
{
|
|
StartCoroutine(HandoffImage());
|
|
|
|
}
|
|
|
|
IEnumerator HandoffImage()
|
|
{
|
|
|
|
yield return new WaitForSeconds(2F);
|
|
|
|
float value = 1;
|
|
|
|
while (value >=0)
|
|
{
|
|
value -= 0.01F;
|
|
image.GetComponent<CanvasGroup>().alpha = value;
|
|
yield return null;
|
|
}
|
|
|
|
SpriteInt++;
|
|
if (SpriteInt <= spriteList.Count-1)
|
|
{
|
|
image.sprite = spriteList[SpriteInt];
|
|
}
|
|
else
|
|
{
|
|
SpriteInt = 0;
|
|
image.sprite = spriteList[SpriteInt];
|
|
|
|
}
|
|
|
|
float value2 = 0;
|
|
while (value2 <= 1)
|
|
{
|
|
value += 0.01F;
|
|
image.GetComponent<CanvasGroup>().alpha = value;
|
|
yield return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|