H_SafeExperienceDrivingSystem/U3D_DrivingSystem/Assets/Script/Objective/ElectricFan.cs

31 lines
565 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ElectricFan : MonoBehaviour
{
bool isVisable = false;
public Transform fan;
// Update is called once per frame
void Update()
{
//if (isVisable)
//{
fan.transform.Rotate(0,0,-10f*Time.deltaTime);
// }
}
private void OnBecameVisible()
{
Debug.Log("vis");
isVisable = true;
}
private void OnBecameInvisible()
{
Debug.Log("Invis");
isVisable = false;
}
}