Global Game Jam 2023
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

89 lines
1.7 KiB

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using NaughtyAttributes;
  5. /// <summary>
  6. ///
  7. /// </summary>
  8. public class BoatRowController : MonoBehaviour
  9. {
  10. #region Inspector Fields
  11. public Collider m_oar;
  12. public Transform m_oarTip;
  13. #endregion Inspector Fields
  14. #region Private Fields
  15. private Vector3 m_lastKnownOarPosition;
  16. #endregion Private Fields
  17. #region Getters
  18. #endregion Getters
  19. #region MonoBehaviour Functions
  20. /// <summary>
  21. /// OnEnable is called when the object becomes enabled and active.
  22. /// </summary>
  23. private void OnEnable()
  24. {
  25. }
  26. /// <summary>
  27. /// OnDisable is called when the behaviour becomes disabled.
  28. /// </summary>
  29. private void OnDisable()
  30. {
  31. }
  32. /// <summary>
  33. /// Update is called once per frame
  34. /// </summary>
  35. private void Update()
  36. {
  37. }
  38. #endregion MonoBehaviour Functions
  39. #region Class Functionality
  40. private void OnTriggerEnter(Collider other)
  41. {
  42. if(other == m_oar)
  43. {
  44. m_lastKnownOarPosition = m_oarTip.position;
  45. }
  46. }
  47. void OnTriggerStay(Collider other)
  48. {
  49. if(other == m_oar)
  50. {
  51. Vector3 direction = m_lastKnownOarPosition - m_oarTip.position;
  52. direction = Vector3.Project(direction,transform.forward);
  53. }
  54. }
  55. #endregion Class Functionality
  56. #region Editor Functions
  57. /// <summary>
  58. /// Called when the Component is created or Reset from the Inspector
  59. /// </summary>
  60. private void Reset()
  61. {
  62. //useful for finding components on creation
  63. }
  64. #endregion Editor Functions
  65. }