2
0

GameplayUtils.lua 1.1 KB

123456789101112131415161718192021222324252627282930
  1. ----------------------------------------------------------------------------------------------------
  2. --
  3. -- Copyright (c) Contributors to the Open 3D Engine Project.
  4. -- For complete copyright and license terms please see the LICENSE at the root of this distribution.
  5. --
  6. -- SPDX-License-Identifier: Apache-2.0 OR MIT
  7. --
  8. --
  9. --
  10. ----------------------------------------------------------------------------------------------------
  11. -- require with:
  12. -- local gameplayMultiHandler = require('scripts.utils.components.gameplayutils')
  13. -- use like:
  14. -- self.gameplayHandlers = gameplayMultiHandler.ConnectMultiHandlers{
  15. -- [GameplayNotificationId("jump")] = {
  16. -- OnEventBegin = function(floatValue) self:JumpStart(floatValue) end,
  17. -- OnEventUpdating = function(floatValue) self:Jumping(floatValue) end,
  18. -- OnEventEnd = function(floatValue) self:JumpEnded(floatValue) end,
  19. -- },
  20. -- }
  21. -- disconnect from like this:
  22. -- self.gameplayHandlers:Disconnect()
  23. local multiHandlers = require('scripts.utils.components.MultiHandlers')
  24. return {
  25. ConnectMultiHandlers = multiHandlers(GameplayNotificationBus, GameplayNotificationId),
  26. }