You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.5 KiB
59 lines
1.5 KiB
//========= Copyright 2016-2020, HTC Corporation. All rights reserved. ===========
|
|
|
|
using HTC.UnityPlugin.Utility;
|
|
using System;
|
|
using UnityEngine;
|
|
|
|
namespace HTC.UnityPlugin.PoseTracker
|
|
{
|
|
[RequireComponent(typeof(BasePoseTracker))]
|
|
public abstract class BasePoseModifier : MonoBehaviour, IPoseModifier
|
|
{
|
|
[SerializeField]
|
|
private int m_priority;
|
|
|
|
public BasePoseTracker baseTracker { get; protected set; }
|
|
|
|
public virtual int priority
|
|
{
|
|
get { return m_priority; }
|
|
set
|
|
{
|
|
if (m_priority != value)
|
|
{
|
|
m_priority = value;
|
|
// let tracker refresh order
|
|
if (baseTracker.RemoveModifier(this))
|
|
{
|
|
baseTracker.AddModifier(this);
|
|
}
|
|
};
|
|
}
|
|
}
|
|
#if UNITY_EDITOR
|
|
protected virtual void OnValidate()
|
|
{
|
|
priority = m_priority;
|
|
}
|
|
#endif
|
|
protected virtual void Awake()
|
|
{
|
|
baseTracker = GetComponent<BasePoseTracker>();
|
|
baseTracker.AddModifier(this);
|
|
}
|
|
|
|
protected virtual void OnEnable() { }
|
|
|
|
protected virtual void OnDisable() { }
|
|
|
|
protected virtual void OnDestroy()
|
|
{
|
|
baseTracker.RemoveModifier(this);
|
|
}
|
|
|
|
[Obsolete]
|
|
public virtual void ModifyPose(ref Pose pose, Transform origin) { }
|
|
|
|
public virtual void ModifyPose(ref RigidPose pose, Transform origin) { }
|
|
}
|
|
}
|