using BNG; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Events; public class WheelActivator : MonoBehaviour { [SerializeField] private List grabbers = new List(); public UnityEvent OnActivate; public UnityEvent OnDeactivate; public bool StartActive = false; public bool Active = false; private void Awake() { if (StartActive) Activate(); else Deactivate(); } private void Activate() { Active = true; OnActivate?.Invoke(); } private void Deactivate() { Active = false; OnDeactivate?.Invoke(); } public void TryActivate(Grabber grabber) { if (!grabbers.Contains(grabber)) { grabbers.Add(grabber); if (grabbers.Count == 2) { Activate(); } } } public void TryDeactivate(Grabber grabber) { if (grabbers.Contains(grabber)) { grabbers.Remove(grabber); Deactivate(); } } }