using ABI_RC.Core.Networking.IO.Social; using ABI_RC.Core.Player; using System; using System.Collections.Generic; using System.Text; using UnityEngine; namespace ml_prm { class RemoteGestureHandler : MonoBehaviour { internal class GestureEvent { event Action m_action; public void AddHandler(Action p_listener) => m_action += p_listener; public void RemoveHandler(Action p_listener) => m_action -= p_listener; public void Invoke(T1 p_objA, T2 p_objB, T3 p_objC) => m_action?.Invoke(p_objA, p_objB, p_objC); } public static readonly GestureEvent OnGestureState = new GestureEvent(); PuppetMaster m_puppetMaster = null; bool m_stateLeft = false; bool m_stateRight = false; void Start() { m_puppetMaster = this.GetComponent(); } void Update() { bool l_state = m_puppetMaster.IsLeftGrabPointerActive(); if(m_stateLeft != l_state) { m_stateLeft = l_state; if(!Settings.FriendsGrab || Friends.FriendsWith(m_puppetMaster.CVRPlayerEntity.PlayerDescriptor.ownerId)) OnGestureState.Invoke(m_puppetMaster, true, m_stateLeft); } l_state = m_puppetMaster.IsRightGrabPointerActive(); if(m_stateRight != l_state) { m_stateRight = l_state; if(!Settings.FriendsGrab || Friends.FriendsWith(m_puppetMaster.CVRPlayerEntity.PlayerDescriptor.ownerId)) OnGestureState.Invoke(m_puppetMaster, false, m_stateRight); } } } }