public void SetAsset(InputActionAsset newAsset) { if (newAsset == asset) { return; } var PilotTankCallbacks = m_PilotTankActionsCallbackInterface; var ChiefControlsCallbacks = m_ChiefControlsActionsCallbackInterface; var ArtilleryCallbacks = m_ArtilleryActionsCallbackInterface; if (m_Initialized) { Uninitialize(); } asset = newAsset; PilotTank.SetCallbacks(PilotTankCallbacks); ChiefControls.SetCallbacks(ChiefControlsCallbacks); Artillery.SetCallbacks(ArtilleryCallbacks); }
private void Uninitialize() { if (m_PilotTankActionsCallbackInterface != null) { PilotTank.SetCallbacks(null); } m_PilotTank = null; m_PilotTank_MoveRightLever = null; if (m_PilotTankMoveRightLeverActionStarted != null) { m_PilotTank_MoveRightLever.started -= m_PilotTankMoveRightLeverActionStarted.Invoke; } if (m_PilotTankMoveRightLeverActionPerformed != null) { m_PilotTank_MoveRightLever.performed -= m_PilotTankMoveRightLeverActionPerformed.Invoke; } if (m_PilotTankMoveRightLeverActionCancelled != null) { m_PilotTank_MoveRightLever.cancelled -= m_PilotTankMoveRightLeverActionCancelled.Invoke; } m_PilotTank_MoveLeftLever = null; if (m_PilotTankMoveLeftLeverActionStarted != null) { m_PilotTank_MoveLeftLever.started -= m_PilotTankMoveLeftLeverActionStarted.Invoke; } if (m_PilotTankMoveLeftLeverActionPerformed != null) { m_PilotTank_MoveLeftLever.performed -= m_PilotTankMoveLeftLeverActionPerformed.Invoke; } if (m_PilotTankMoveLeftLeverActionCancelled != null) { m_PilotTank_MoveLeftLever.cancelled -= m_PilotTankMoveLeftLeverActionCancelled.Invoke; } m_PilotTank_StopLeft = null; if (m_PilotTankStopLeftActionStarted != null) { m_PilotTank_StopLeft.started -= m_PilotTankStopLeftActionStarted.Invoke; } if (m_PilotTankStopLeftActionPerformed != null) { m_PilotTank_StopLeft.performed -= m_PilotTankStopLeftActionPerformed.Invoke; } if (m_PilotTankStopLeftActionCancelled != null) { m_PilotTank_StopLeft.cancelled -= m_PilotTankStopLeftActionCancelled.Invoke; } m_PilotTank_StopRight = null; if (m_PilotTankStopRightActionStarted != null) { m_PilotTank_StopRight.started -= m_PilotTankStopRightActionStarted.Invoke; } if (m_PilotTankStopRightActionPerformed != null) { m_PilotTank_StopRight.performed -= m_PilotTankStopRightActionPerformed.Invoke; } if (m_PilotTankStopRightActionCancelled != null) { m_PilotTank_StopRight.cancelled -= m_PilotTankStopRightActionCancelled.Invoke; } m_PilotTank_StopAll = null; if (m_PilotTankStopAllActionStarted != null) { m_PilotTank_StopAll.started -= m_PilotTankStopAllActionStarted.Invoke; } if (m_PilotTankStopAllActionPerformed != null) { m_PilotTank_StopAll.performed -= m_PilotTankStopAllActionPerformed.Invoke; } if (m_PilotTankStopAllActionCancelled != null) { m_PilotTank_StopAll.cancelled -= m_PilotTankStopAllActionCancelled.Invoke; } m_PilotTank_repair = null; if (m_PilotTankRepairActionStarted != null) { m_PilotTank_repair.started -= m_PilotTankRepairActionStarted.Invoke; } if (m_PilotTankRepairActionPerformed != null) { m_PilotTank_repair.performed -= m_PilotTankRepairActionPerformed.Invoke; } if (m_PilotTankRepairActionCancelled != null) { m_PilotTank_repair.cancelled -= m_PilotTankRepairActionCancelled.Invoke; } if (m_ChiefControlsActionsCallbackInterface != null) { ChiefControls.SetCallbacks(null); } m_ChiefControls = null; m_ChiefControls_RClick = null; if (m_ChiefControlsRClickActionStarted != null) { m_ChiefControls_RClick.started -= m_ChiefControlsRClickActionStarted.Invoke; } if (m_ChiefControlsRClickActionPerformed != null) { m_ChiefControls_RClick.performed -= m_ChiefControlsRClickActionPerformed.Invoke; } if (m_ChiefControlsRClickActionCancelled != null) { m_ChiefControls_RClick.cancelled -= m_ChiefControlsRClickActionCancelled.Invoke; } m_ChiefControls_LClick = null; if (m_ChiefControlsLClickActionStarted != null) { m_ChiefControls_LClick.started -= m_ChiefControlsLClickActionStarted.Invoke; } if (m_ChiefControlsLClickActionPerformed != null) { m_ChiefControls_LClick.performed -= m_ChiefControlsLClickActionPerformed.Invoke; } if (m_ChiefControlsLClickActionCancelled != null) { m_ChiefControls_LClick.cancelled -= m_ChiefControlsLClickActionCancelled.Invoke; } if (m_ArtilleryActionsCallbackInterface != null) { Artillery.SetCallbacks(null); } m_Artillery = null; m_Artillery_RotateY = null; if (m_ArtilleryRotateYActionStarted != null) { m_Artillery_RotateY.started -= m_ArtilleryRotateYActionStarted.Invoke; } if (m_ArtilleryRotateYActionPerformed != null) { m_Artillery_RotateY.performed -= m_ArtilleryRotateYActionPerformed.Invoke; } if (m_ArtilleryRotateYActionCancelled != null) { m_Artillery_RotateY.cancelled -= m_ArtilleryRotateYActionCancelled.Invoke; } m_Artillery_RotateX = null; if (m_ArtilleryRotateXActionStarted != null) { m_Artillery_RotateX.started -= m_ArtilleryRotateXActionStarted.Invoke; } if (m_ArtilleryRotateXActionPerformed != null) { m_Artillery_RotateX.performed -= m_ArtilleryRotateXActionPerformed.Invoke; } if (m_ArtilleryRotateXActionCancelled != null) { m_Artillery_RotateX.cancelled -= m_ArtilleryRotateXActionCancelled.Invoke; } m_Artillery_Fire = null; if (m_ArtilleryFireActionStarted != null) { m_Artillery_Fire.started -= m_ArtilleryFireActionStarted.Invoke; } if (m_ArtilleryFireActionPerformed != null) { m_Artillery_Fire.performed -= m_ArtilleryFireActionPerformed.Invoke; } if (m_ArtilleryFireActionCancelled != null) { m_Artillery_Fire.cancelled -= m_ArtilleryFireActionCancelled.Invoke; } m_Artillery_Reload = null; if (m_ArtilleryReloadActionStarted != null) { m_Artillery_Reload.started -= m_ArtilleryReloadActionStarted.Invoke; } if (m_ArtilleryReloadActionPerformed != null) { m_Artillery_Reload.performed -= m_ArtilleryReloadActionPerformed.Invoke; } if (m_ArtilleryReloadActionCancelled != null) { m_Artillery_Reload.cancelled -= m_ArtilleryReloadActionCancelled.Invoke; } m_Initialized = false; }