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
/* | |
MIT License | |
Copyright (c) 2021 Noé Charron | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |
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; | |
using System.Collections; | |
using UnityEngine; | |
public class ScreenshotTool : MonoBehaviour { | |
private static ScreenshotTool control; | |
private void Awake() { | |
control = this; |
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
public struct MultiBool { | |
private int count; | |
private bool hasMin; | |
private bool hasMax; | |
private int max; | |
private int min; | |
public static MultiBool WithMin(int min) { | |
MultiBool b = new MultiBool(); |
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 UnityEngine; | |
public class DirectionMaze : MonoBehaviour { | |
[System.Flags] | |
public enum Direction { | |
Up = 1 << 0, | |
Down = 1 << 1, | |
Left = 1 << 2, | |
Right = 1 << 3 |
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 UnityEngine; | |
public class Maze : MonoBehaviour { | |
public Vector2Int mazeSize = new Vector2Int(15, 15); // this should b odd dimensions | |
[SerializeField] | |
public bool drawGizmos = true; | |
private bool[, ] maze; | |
private Vector2Int prevSize; // delete this, the OnValidate() method, n the OnDrawGizmos() method if u dont wanna preview it in the editor |
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
// based on how ive been told unity did it: | |
// https://stackoverflow.com/questions/61372498/how-does-mathf-smoothdamp-work-what-is-it-algorithm | |
public static Color ColourSmoothDamp(Color current, Color target, ref Vector4 currentVelocity, float smoothTime) => | |
ColourSmoothDamp(current, target, ref currentVelocity, smoothTime, Mathf.Infinity, Time.deltaTime); | |
public static Color ColourSmoothDamp(Color current, Color target, ref Vector4 currentVelocity, float smoothTime, float maxSpeed) => | |
ColourSmoothDamp(current, target, ref currentVelocity, smoothTime, maxSpeed, Time.deltaTime); | |
public static Color ColourSmoothDamp(Color current, Color target, ref Vector4 currentVelocity, float smoothTime, float maxSpeed, float deltaTime) { | |
// Based on Game Programming Gems 4 Chapter 1.10 |