38261d0800
* Updated all copyright headers to split the longer original copyright line into 2 shorter lines Signed-off-by: Steve Pham <spham@amazon.com>
43 lines
1.4 KiB
Lua
43 lines
1.4 KiB
Lua
----------------------------------------------------------------------------------------------------
|
|
--
|
|
-- 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
|