Skip to content

Instantly share code, notes, and snippets.

View MysticFragilist's full-sized avatar
👋

Samuel Montambault MysticFragilist

👋
View GitHub Profile
@MysticFragilist
MysticFragilist / Medium-Unity-InputSystem-1.cs
Last active May 31, 2020 17:51
A sample of a Game Manager script to embed in Medium
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;
@MysticFragilist
MysticFragilist / Medium-Unity-InputSystem-2.cs
Last active May 31, 2020 17:52
A sample of a Game Manager script to embed in Medium
// 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;
@MysticFragilist
MysticFragilist / coffee_prg.cs
Last active January 12, 2023 04:51
Coffee!!
while(!coffee.isEmpty) {
coffee.Drink();
}