Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using UnityEngine.UI;
- using UnityEngine.EventSystems;
- using UnityEngine.SceneManagement;
- public class EndingSystem : MonoBehaviour
- {
- public GameObject LockImg;
- public EventSystem eventsystem; //イベントシステム(いろんなことに使う)の定義
- public GameObject Intro;
- public GameObject IntroClose;
- public GameObject EndingOpen;
- public GameObject Letter;
- public GameObject ClearNext;
- // Use this for initialization
- void Start()
- {
- FadeOut();
- eventsystem = GameObject.Find("EventSystem").GetComponent<EventSystem>();
- EndingOpen.SetActive(false);
- Letter.SetActive(false);
- ClearNext.SetActive(false);
- }
- // Update is called once per frame
- void Update ()
- {
- if (eventsystem.currentSelectedGameObject == null)
- {// UI以外(3D)をさわった
- }
- else
- {
- if (Input.GetMouseButtonUp(0))
- { //左クリック
- switch (eventsystem.currentSelectedGameObject.name)
- {
- case "Logo":
- iTween.MoveTo(GameObject.Find("Intro"),
- iTween.Hash("y", 0, "time", 0.8, "islocal", true, "easeType", iTween.EaseType.easeInOutQuad));
- break;
- case "IntroClose":
- iTween.MoveTo(GameObject.Find("Intro"),
- iTween.Hash("y", 830, "time", 0.8, "islocal", true, "easeType", iTween.EaseType.easeInOutQuad));
- break;
- case "Btn_Skip_Img":
- FadeIn();
- Invoke("EndingImg", 0.5f);
- break;
- case "EndingClose":
- FadeIn();
- Invoke("NextLetter", 0.5f);
- break;
- case "LetterClose":
- FadeIn();
- Invoke("NextClear", 0.5f);
- break;
- }
- }
- }
- }
- void EndingImg()
- {
- FadeOut();
- EndingOpen.SetActive(true);
- }
- void NextLetter()
- {
- FadeOut();
- Letter.SetActive(true);
- EndingOpen.SetActive(false);
- LockOut();
- Invoke("LockOpen", 0.5f);
- Debug.Log("LockIn();");
- }
- void LockOpen()
- {
- LockIn();
- Debug.Log("LockOpen()");
- }
- void NextClear()
- {
- FadeOut();
- ClearNext.SetActive(true);
- Invoke("NextTop", 1.5f);
- }
- void NextTop()
- {
- FadeIn();
- SceneManager.LoadScene("top");
- }
- void FadeIn()
- {
- // SetValue()を毎フレーム呼び出して、1秒間に0から1までの値の中間値を渡す
- iTween.ValueTo(gameObject, iTween.Hash("from", 0f, "to", 1f, "time", 0.5f, "onupdate", "SetValue"));
- }
- void FadeOut()
- {
- // SetValue()を毎フレーム呼び出して、1秒間に1から0までの値の中間値を渡す
- iTween.ValueTo(gameObject, iTween.Hash("from", 1f, "to", 0f, "time", 0.5f, "onupdate", "SetValue"));
- }
- void SetValue(float alpha)
- {
- // iTweenで呼ばれたら、受け取った値をImageのアルファ値にセット
- gameObject.GetComponent<UnityEngine.UI.Image>().color = new Color(1, 1, 1, alpha);
- }
- void LockIn()
- {
- // SetValue()を毎フレーム呼び出して、1秒間に0から1までの値の中間値を渡す
- iTween.ValueTo( this.LockImg, iTween.Hash("from", 0f, "to", 2f, "time", 10.0f, "onupdate", "LockSetValue"));
- }
- void LockOut()
- {
- // SetValue()を毎フレーム呼び出して、1秒間に1から0までの値の中間値を渡す
- iTween.ValueTo(this.LockImg, iTween.Hash("from", 2f, "to", 0f, "time", 10.0f, "onupdate", "LockSetValue"));
- }
- void LockSetValue(float alpha)
- {
- // iTweenで呼ばれたら、受け取った値をImageのアルファ値にセット
- this.LockImg.GetComponent<UnityEngine.UI.Image>().color = new Color(1, 1, 1, alpha);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement