---------------------------------------------------------------------------------------------------- -- -- Copyright (c) Contributors to the Open 3D Engine Project. -- For complete copyright and license terms please see the LICENSE at the root of this distribution. -- -- SPDX-License-Identifier: Apache-2.0 OR MIT -- -- -- ---------------------------------------------------------------------------------------------------- local held = { Properties = { IncomingInputEventName = "", OutgoingGameplayEventName = "", }, } function held:OnActivate() local inputBusId = InputEventNotificationId(self.Properties.IncomingInputEventName) self.inputBus = InputEventNotificationBus.Connect(self, inputBusId) end function held:OnPressed(floatValue) GameplayNotificationBus.Event.OnEventBegin(GameplayNotificationId(self.entityId, self.Properties.OutgoingGameplayEventName, "float"), floatValue) end function held:OnHeld(floatValue) GameplayNotificationBus.Event.OnEventUpdating(GameplayNotificationId(self.entityId, self.Properties.OutgoingGameplayEventName, "float"), floatValue) end function held:OnReleased(floatValue) GameplayNotificationBus.Event.OnEventEnd(GameplayNotificationId(self.entityId, self.Properties.OutgoingGameplayEventName, "float"), floatValue) end function held:OnDeactivate() self.inputBus:Disconnect() end return held