Trigger_ScriptBinding.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2013 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. class Trigger;
  23. ConsoleMethodGroupBeginWithDocs(Trigger, SceneObject)
  24. /*! Set whether trigger checks onEnter events
  25. @param setting Default is true.
  26. @return No return value.
  27. */
  28. ConsoleMethodWithDocs(Trigger, setEnterCallback, ConsoleVoid, 2, 3, ([setting]?))
  29. {
  30. // If the value isn't specified, the default is true.
  31. bool callback = true;
  32. if (argc > 2)
  33. callback = dAtob(argv[2]);
  34. object->setEnterCallback(callback);
  35. }
  36. //-----------------------------------------------------------------------------
  37. /*! Set whether trigger checks onStay events
  38. @param setting Default is true.
  39. @return No return value.
  40. */
  41. ConsoleMethodWithDocs(Trigger, setStayCallback, ConsoleVoid, 2, 3, ([setting]?))
  42. {
  43. // If the value isn't specified, the default is true.
  44. bool callback = true;
  45. if (argc > 2)
  46. callback = dAtob(argv[2]);
  47. object->setStayCallback(callback);
  48. }
  49. //-----------------------------------------------------------------------------
  50. /*! Set whether trigger checks onLeave events
  51. @param setting Default is true.
  52. @return No return value.
  53. */
  54. ConsoleMethodWithDocs(Trigger, setLeaveCallback, ConsoleVoid, 2, 3, ([setting]?))
  55. {
  56. // If the value isn't specified, the default is true.
  57. bool callback = true;
  58. if (argc > 2)
  59. callback = dAtob(argv[2]);
  60. object->setLeaveCallback(callback);
  61. }
  62. //-----------------------------------------------------------------------------
  63. /*!
  64. @return Returns whether trigger checks onEnter events
  65. */
  66. ConsoleMethodWithDocs(Trigger, getEnterCallback, ConsoleBool, 2, 2, ())
  67. {
  68. return object->getEnterCallback();
  69. }
  70. //-----------------------------------------------------------------------------
  71. /*!
  72. @return Returns whether trigger checks onStay events
  73. */
  74. ConsoleMethodWithDocs(Trigger, getStayCallback, ConsoleBool, 2, 2, ())
  75. {
  76. return object->getStayCallback();
  77. }
  78. //-----------------------------------------------------------------------------
  79. /*!
  80. @return Returns whether trigger checks onLeave events
  81. */
  82. ConsoleMethodWithDocs(Trigger, getLeaveCallback, ConsoleBool, 2, 2, ())
  83. {
  84. return object->getLeaveCallback();
  85. }
  86. //-----------------------------------------------------------------------------
  87. ConsoleMethodGroupEndWithDocs(Trigger)