VRCivilisation2/Assets/mes190.cs

75 lines
1.4 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class mes190 : MonoBehaviour
{
public Animator _Animator;
private int anim = Animator.StringToHash("bo");
public bool _b;
public bool _b1;
public bool _b2;
public bool _b3;
public bool _b4;
private void Update()
{
if (_b1&&_b2&&_b4&&_b3==false)
{
StartCoroutine(On());
_b3 = true;
}
if (_b1==false||_b2==false)
{
StopCoroutine(On());
_b3 = false;
}
}
private void OnTriggerStay(Collider other)
{
if (_b==false)
{
if (other.gameObject.name=="22")
{
_b1 = true;
}
if (other.gameObject.name=="33")
{
_b2 = true;
}
}
}
private void OnTriggerExit(Collider other)
{
if (_b==false)
{
if (other.gameObject.name=="22")
{
_b1 = false;
}
if (other.gameObject.name=="33")
{
_b2 = false;
}
}
}
IEnumerator On()
{
yield return new WaitForSeconds(5);
if (_b1&&_b2&&_b3&&_b4)
{
_Animator.SetTrigger(anim);
_b = true;
}
}
}