Created
September 30, 2018 07:56
-
-
Save nabesi777/3ed7b0d22f68b570737cba56677670ad to your computer and use it in GitHub Desktop.
視点ポインターでシーン移行
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEngine.SceneManagement; | |
public class Main : MonoBehaviour | |
{ | |
public GameObject button; | |
private bool count; | |
private float time; | |
// Use this for initialization | |
void Start() | |
{ | |
time = 0; | |
count = false; | |
} | |
// Update is called once per frame | |
void Update() | |
{ | |
if (count) | |
{ //countがtrueの時は時間が進む | |
time += Time.deltaTime; | |
if (time >= 1) | |
{//一秒以上見つめるとPlayモードへ移行 | |
SceneManager.LoadScene("Play"); | |
} | |
} | |
} | |
public void OnEnterPointer() | |
{ | |
count = true; | |
} | |
//視点がオブジェクトから外れたら | |
public void OnExitPonter() | |
{ | |
count = false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment