using Microsoft.MixedReality.Toolkit.Input;
using Microsoft.MixedReality.Toolkit.UI;
using Microsoft.MixedReality.Toolkit.Utilities;
using System.Collections.Generic;
using UnityEngine;
public class Device : MonoBehaviour, IMixedRealityTouchHandler, IMixedRealityInputHandler, IMixedRealityFocusHandler
{
private MeshOutline meshOutline;
[HideInInspector]
///
/// 是否完成
///
public bool isCompleted;
[HideInInspector]
///
/// 初始位置
///
public Vector3 initialPos;
[HideInInspector]
public Vector3 initialRot;
public static List devices = new List();
private void Awake()
{
initialPos = transform.localPosition;
initialRot = transform.localEulerAngles;
}
// Start is called before the first frame update
public virtual void Start()
{
devices.Add(this);
Init();
MiddleInit();
}
///
/// 初始化
///
public virtual void Init()
{
transform.localEulerAngles = initialRot;
transform.localPosition = initialPos;
}
///
/// 重进房间初始化
///
public virtual void MiddleInit()
{
}
///
/// 点击物体按下
///
///
public virtual void OnInputDown(InputEventData eventData)
{
//Debug.Log("OnInputDown");
}
///
/// 点击物体抬起
///
///
public virtual void OnInputUp(InputEventData eventData)
{
//Debug.Log(gameObject.name+"OnInputUp");
}
///
/// 开始触碰
///
///
public virtual void OnTouchStarted(HandTrackingInputEventData eventData)
{
//Debug.Log("接触点位置:"+ eventData.InputData.ToString());
}
///
/// 持续触碰
///
///
public virtual void OnTouchUpdated(HandTrackingInputEventData eventData)
{
// Debug.Log("接触点位置:" + eventData.InputData.ToString());
}
///
/// 结束触碰
///
///
public virtual void OnTouchCompleted(HandTrackingInputEventData eventData)
{
//Debug.Log("OnTouchCompleted");
}
///
/// 开始抓握
///
///
public virtual void OnManipulationStarted(ManipulationEventData eventData)
{
//Debug.Log(eventData.Pointer.Position.ToString());
}
///
/// 结束抓握
///
///
public virtual void OnManipulationEnded(ManipulationEventData eventData)
{
//Debug.Log("OnManipulationEnded");
}
///
/// 开始触碰
///
///
public virtual void OnHoverEntered(ManipulationEventData eventData)
{
//Debug.Log("OnHoverEntered");
}
///
/// 结束触碰
///
///
public virtual void OnHoverExited(ManipulationEventData eventData)
{
//Debug.Log("OnHoverExited");
}
///
/// 光标进入
///
///
public virtual void OnFocusEnter(FocusEventData eventData)
{
// Debug.Log("OnFocusEnter");
}
///
/// 光标移出
///
///
public virtual void OnFocusExit(FocusEventData eventData)
{
// Debug.Log("OnFocusExit");
}
}