Created
March 29, 2017 09:02
-
-
Save TeraokaAkihiro/8e672c00d5da71cb9dfbdb31cd9e7a88 to your computer and use it in GitHub Desktop.
This file contains 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
// ぴにゃタワーVRの判定用スクリプト | |
// OnTriggerでpinyaのタグついたオブジェクトをカウント | |
// [未実装]掴んでいるオブジェクトは含まないようにする。 | |
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class GameManager : MonoBehaviour { | |
bool isFailed = false; // Pinya got out → true | |
public int maxPinyaCount = 0; // Stay Count Pinyaa | |
VRTK_grabChecker vrtk_grabChecker; // Getter Pinya Object isGrab | |
// 衝突しているオブジェクトリスト | |
private List<GameObject> pinyas = new List<GameObject>(); // use pinya & maxPinyaCount | |
void Start () {} | |
// Update is called once per frame | |
void Update () | |
{ | |
if (!isFailed) | |
maxPinyaCount = pinyas.Count; // Max pinya Count | |
} | |
void OnTriggerEnter(Collider col) | |
{ | |
Debug.Log("Enter : "+col.gameObject.name); //Debug Code | |
if (col.gameObject.CompareTag("pinya") && !pinyas.Contains(col.gameObject)) //Add list pinya | |
pinyas.Add(col.gameObject); | |
} | |
void OnTriggerExit(Collider col) | |
{ | |
vrtk_grabChecker = col.gameObject.GetComponent<VRTK_grabChecker>(); // using | |
Debug.Log("Exit : " + col.gameObject.name +" : " + vrtk_grabChecker.testVar.ToString()); //Debug code | |
isFailed = true; | |
if (col.gameObject.CompareTag("pinya") && pinyas.Contains(col.gameObject)) //Remove list pinya | |
pinyas.Remove(col.gameObject); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment