浏览代码

Remove UX scene-specific script to fade plane

/4.1
Tim Mowrer 4 年前
当前提交
50a5c4b8
共有 2 个文件被更改,包括 0 次插入67 次删除
  1. 56
      Assets/Scripts/UX/FadePlaneOnBoundaryChange.cs
  2. 11
      Assets/Scripts/UX/FadePlaneOnBoundaryChange.cs.meta

56
Assets/Scripts/UX/FadePlaneOnBoundaryChange.cs


using UnityEngine;
using UnityEngine.XR.ARFoundation;
namespace UnityEngine.XR.ARFoundation.Samples
{
[RequireComponent(typeof(ARPlane))]
[RequireComponent(typeof(Animator))]
public class FadePlaneOnBoundaryChange : MonoBehaviour
{
const string k_FadeOffAnim = "FadeOff";
const string k_FadeOnAnim = "FadeOn";
const float k_TimeOut = 2.0f;
Animator m_Animator;
ARPlane m_Plane;
float m_ShowTime = 0;
bool m_UpdatingPlane = false;
void OnEnable()
{
m_Plane = GetComponent<ARPlane>();
m_Animator = GetComponent<Animator>();
m_Plane.boundaryChanged += PlaneOnBoundaryChanged;
}
void OnDisable()
{
m_Plane.boundaryChanged -= PlaneOnBoundaryChanged;
}
void Update()
{
if (m_UpdatingPlane)
{
m_ShowTime -= Time.deltaTime;
if (m_ShowTime <= 0)
{
m_UpdatingPlane = false;
m_Animator.SetBool(k_FadeOffAnim, true);
m_Animator.SetBool(k_FadeOnAnim, false);
}
}
}
void PlaneOnBoundaryChanged(ARPlaneBoundaryChangedEventArgs obj)
{
m_Animator.SetBool(k_FadeOffAnim, false);
m_Animator.SetBool(k_FadeOnAnim, true);
m_UpdatingPlane = true;
m_ShowTime = k_TimeOut;
}
}
}

11
Assets/Scripts/UX/FadePlaneOnBoundaryChange.cs.meta


fileFormatVersion: 2
guid: 88dbe81e1cd074727b11130714ca8d83
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存