Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ぴにゃタワー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);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement