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.

86 lines
1.6 KiB

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using NaughtyAttributes;
  5. /// <summary>
  6. ///
  7. /// </summary>
  8. public class PlayerController : MonoBehaviour
  9. {
  10. #region Inspector Fields
  11. public OarController oar;
  12. public HandController leftHand;
  13. public HandController rightHand;
  14. #endregion Inspector Fields
  15. #region Private Fields
  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. rightHand.UpdateHand(Vector2.up);
  26. }
  27. /// <summary>
  28. /// OnDisable is called when the behaviour becomes disabled.
  29. /// </summary>
  30. private void OnDisable()
  31. {
  32. }
  33. /// <summary>
  34. /// Update is called once per frame
  35. /// </summary>
  36. private void FixedUpdate()
  37. {
  38. if (oar.isColliding())
  39. {
  40. leftHand.UndoLastMovement();
  41. rightHand.UndoLastMovement();
  42. oar.UpdateTransform();
  43. }
  44. leftHand.UpdateHand(leftHand.m_desiredInput);
  45. rightHand.UpdateHand(rightHand.m_desiredInput);
  46. oar.UpdateTransform();
  47. }
  48. #endregion MonoBehaviour Functions
  49. #region Class Functionality
  50. #endregion Class Functionality
  51. #region Editor Functions
  52. /// <summary>
  53. /// Called when the Component is created or Reset from the Inspector
  54. /// </summary>
  55. private void Reset()
  56. {
  57. //useful for finding components on creation
  58. }
  59. #endregion Editor Functions
  60. }