34 lines
602 B
Plaintext
34 lines
602 B
Plaintext
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.Events;
|
|
|
|
[System.Serializable]
|
|
public class OnToggleChangeEvent : UnityEvent<bool>
|
|
{
|
|
|
|
}
|
|
|
|
|
|
public class Toggleable : Clickable
|
|
{
|
|
public OnToggleChangeEvent m_onToggle;
|
|
|
|
[SerializeField]
|
|
private bool m_toggleOn = false;
|
|
|
|
public override void ClearInteractableEvents()
|
|
{
|
|
base.ClearInteractableEvents();
|
|
|
|
m_onToggle.RemoveAllListeners();
|
|
}
|
|
|
|
public override void OnPressUp()
|
|
{
|
|
m_toggleOn = !m_toggleOn;
|
|
|
|
m_onToggle.Invoke(m_toggleOn);
|
|
}
|
|
}
|