This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using Cinemachine; | |
using UnityEngine; | |
using UnityEngine.InputSystem; | |
[RequireComponent(typeof(CinemachineFreeLook))] | |
public class FreeLookAddOn : MonoBehaviour | |
{ | |
[Range(0f, 10f)] public float LookSpeed = 1f; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Update the look movement each time the event is trigger | |
public void OnLook(InputAction.CallbackContext context) | |
{ | |
//Normalize the vector to have an uniform vector in whichever form it came from (I.E Gamepad, mouse, etc) | |
Vector2 lookMovement = context.ReadValue<Vector2>().normalized; | |
lookMovement.y = InvertY ? -lookMovement.y : lookMovement.y; | |
// This is because X axis is only contains between -180 and 180 instead of 0 and 1 like the Y axis | |
lookMovement.x = lookMovement.x * 180f; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while(!coffee.isEmpty) { | |
coffee.Drink(); | |
} |