WXMC/.svn/pristine/03/03e96b43970485f945d146b6dbd5bf6841bd0816.svn-base

34 lines
602 B
Plaintext
Raw Normal View History

2024-12-04 16:18:46 +08:00
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);
}
}