using UnityEngine;
namespace Pegasus
{
///
/// A trigger that can be placed on a POI to cause something else to happen. Either derive a new class from this, or used one of the derived classes to
/// cause something to happen.
///
public class TriggerBase : MonoBehaviour
{
public bool m_triggerAtStart = true;
public bool m_triggerOnUpdate = false;
public bool m_triggerAtEnd = true;
///
/// Called when the trigger starts
///
///
public virtual void OnStart(PegasusPoi poi)
{
if (poi != null && m_triggerAtStart)
{
if (poi.m_manager.m_displayDebug == true)
{
Debug.Log(string.Format("Started trigger on {0} - {1}", poi.m_manager.name, poi.name));
}
}
}
///
/// Called when the trigger is updated
///
///
public virtual void OnUpdate(PegasusPoi poi, float progress)
{
if (poi != null && m_triggerOnUpdate)
{
if (poi.m_manager.m_displayDebug == true)
{
Debug.Log(string.Format("Udpated trigger on {0} - {1} {2:0.00}", poi.m_manager.name, poi.name, progress));
}
}
}
///
/// Called when the trigger ends
///
///
public virtual void OnEnd(PegasusPoi poi)
{
if (poi != null && m_triggerAtEnd)
{
if (poi.m_manager.m_displayDebug == true)
{
Debug.Log(string.Format("Ended trigger on {0} - {1}", poi.m_manager.name, poi.name));
}
}
}
}
}