using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using UnityEngine; namespace SC.XR.Unity.Module_InputSystem.InputDeviceGC { public class InputDeviceGCPartEventCharging : InputDeviceGCPartEventBase { InputDevicePartDispatchEventGC inputDevicePartDispatchEventGC; public InputDeviceGCPartEventCharging(InputDevicePartDispatchEventGC inputDevicePartDispatchEventGC) : base(inputDevicePartDispatchEventGC) { this.inputDevicePartDispatchEventGC = inputDevicePartDispatchEventGC; } public override void OnSCStart() { base.OnSCStart(); if (inputDevicePartDispatchEventGC.inputDeviceGCPart.inputDataGC.isCharging == true) { currentEvent = GCEventType.BATTERY_STATUS_CHARGING; } else if (inputDevicePartDispatchEventGC.inputDeviceGCPart.inputDataGC.isCharging == false) { currentEvent = GCEventType.BATTERY_STATUS_DISCHARGING; } newevent = previousEvent = currentEvent; } GCEventType newevent; protected override void OnUpdateEvent() { currentEvent = GCEventType.Null; if (inputDevicePartDispatchEventGC.inputDeviceGCPart.inputDataGC.isCharging == true) { newevent = GCEventType.BATTERY_STATUS_CHARGING; } else if (inputDevicePartDispatchEventGC.inputDeviceGCPart.inputDataGC.isCharging == false) { newevent = GCEventType.BATTERY_STATUS_DISCHARGING; } if (newevent != previousEvent) { previousEvent = newevent; currentEvent = newevent; } } } }