Global Game Jam 2022
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.

44 lines
820 B

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.InputSystem;
  5. using NaughtyAttributes;
  6. public class CharacterInputController : MonoBehaviour
  7. {
  8. [SerializeField,Header("References")]
  9. private CharacterController2D m_characterController;
  10. [SerializeField]
  11. private Material m_Darkness;
  12. [ShowNonSerializedField]
  13. private Vector2 m_movement;
  14. [ShowNonSerializedField]
  15. private bool m_jump;
  16. public void OnMove(InputAction.CallbackContext context)
  17. {
  18. m_movement = context.ReadValue<Vector2>();
  19. }
  20. public void OnJump(InputAction.CallbackContext context)
  21. {
  22. m_jump = context.ReadValueAsButton();
  23. }
  24. private void Update()
  25. {
  26. m_characterController.Move(m_movement.x,false ,m_jump);
  27. }
  28. }