浏览代码

Convert tabs to spaces

/1.5-preview
Tim Mowrer 6 年前
当前提交
b85ac7ca
共有 2 个文件被更改,包括 85 次插入86 次删除
  1. 78
      Assets/Scripts/UX/FadePlaneOnBoundaryChange.cs
  2. 93
      Assets/Scripts/UX/UIManager.cs

78
Assets/Scripts/UX/FadePlaneOnBoundaryChange.cs


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;
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;
float m_ShowTime = 0;
bool m_UpdatingPlane = false;
void OnEnable()
{
m_Plane = GetComponent<ARPlane>();
m_Animator = GetComponent<Animator>();
m_Plane.boundaryChanged += PlaneOnBoundaryChanged;
}
void OnEnable()
{
m_Plane = GetComponent<ARPlane>();
m_Animator = GetComponent<Animator>();
m_Plane.boundaryChanged += PlaneOnBoundaryChanged;
}
void OnDisable()
{
m_Plane.boundaryChanged -= PlaneOnBoundaryChanged;
}
void OnDisable()
{
m_Plane.boundaryChanged -= PlaneOnBoundaryChanged;
}
void Update()
{
if (m_UpdatingPlane)
{
m_ShowTime -= Time.deltaTime;
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);
}
}
}
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;
}
void PlaneOnBoundaryChanged(ARPlaneBoundaryChangedEventArgs obj)
{
m_Animator.SetBool(k_FadeOffAnim, false);
m_Animator.SetBool(k_FadeOnAnim, true);
m_UpdatingPlane = true;
m_ShowTime = k_TimeOut;
}
}

93
Assets/Scripts/UX/UIManager.cs


public class UIManager : MonoBehaviour
{
const string k_FadeOffAnim = "FadeOff";
const string k_FadeOnAnim = "FadeOn";
const string k_FadeOffAnim = "FadeOff";
const string k_FadeOnAnim = "FadeOn";
[SerializeField] ARPlaneManager m_PlaneManager;
[SerializeField] Animator m_MoveDeviceAnimation;
[SerializeField] Animator m_TapToPlaceAnimation;
List<ARPlane> m_Planes = new List<ARPlane>();
[SerializeField] ARPlaneManager m_PlaneManager;
[SerializeField] Animator m_MoveDeviceAnimation;
[SerializeField] Animator m_TapToPlaceAnimation;
List<ARPlane> m_Planes = new List<ARPlane>();
bool m_ShowingTapToPlace = false;
bool m_ShowingMoveDevice = true;
bool m_ShowingTapToPlace = false;
bool m_ShowingMoveDevice = true;
void OnEnable()
{
ARSubsystemManager.cameraFrameReceived += FrameChanged;
PlaceMultipleObjectsOnPlane.onPlacedObject += PlacedObject;
}
void OnEnable()
{
ARSubsystemManager.cameraFrameReceived += FrameChanged;
PlaceMultipleObjectsOnPlane.onPlacedObject += PlacedObject;
}
void OnDisable()
{
ARSubsystemManager.cameraFrameReceived -= FrameChanged;
PlaceMultipleObjectsOnPlane.onPlacedObject -= PlacedObject;
}
void OnDisable()
{
ARSubsystemManager.cameraFrameReceived -= FrameChanged;
PlaceMultipleObjectsOnPlane.onPlacedObject -= PlacedObject;
}
void FrameChanged(ARCameraFrameEventArgs args)
{
if (PlanesFound() && m_ShowingMoveDevice)
{
m_MoveDeviceAnimation.SetTrigger(k_FadeOffAnim);
m_TapToPlaceAnimation.SetTrigger(k_FadeOnAnim);
m_ShowingTapToPlace = true;
m_ShowingMoveDevice = false;
}
}
void FrameChanged(ARCameraFrameEventArgs args)
{
if (PlanesFound() && m_ShowingMoveDevice)
{
m_MoveDeviceAnimation.SetTrigger(k_FadeOffAnim);
m_TapToPlaceAnimation.SetTrigger(k_FadeOnAnim);
m_ShowingTapToPlace = true;
m_ShowingMoveDevice = false;
}
}
bool PlanesFound()
{
if (m_PlaneManager)
{
m_PlaneManager.GetAllPlanes(m_Planes);
return m_Planes.Count > 0;
}
return false;
}
bool PlanesFound()
{
if (m_PlaneManager)
{
m_PlaneManager.GetAllPlanes(m_Planes);
return m_Planes.Count > 0;
}
return false;
}
void PlacedObject()
{
if (m_ShowingTapToPlace)
{
m_TapToPlaceAnimation.SetTrigger(k_FadeOffAnim);
m_ShowingTapToPlace = false;
}
}
void PlacedObject()
{
if (m_ShowingTapToPlace)
{
m_TapToPlaceAnimation.SetTrigger(k_FadeOffAnim);
m_ShowingTapToPlace = false;
}
}
}
正在加载...
取消
保存