Skip to content

Instantly share code, notes, and snippets.

@TheCuttlefish
TheCuttlefish / Grayscale.cs
Created November 6, 2019 13:46
Custom Post Processing Effect in Unity (inverting colours)
using System;
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
[Serializable]
[PostProcess(typeof(GrayscaleRenderer), PostProcessEvent.AfterStack, "Custom/Grayscale")]
public sealed class Grayscale : PostProcessEffectSettings
{
[Range(0f, 1f), Tooltip("Grayscale effect intensity.")]
public FloatParameter blend = new FloatParameter { value = 0.5f };
@TheCuttlefish
TheCuttlefish / .cs
Created January 19, 2020 22:34
Colour Mix
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ColourMix : MonoBehaviour {
public Color myColour;
public float r, g, b;
// Update is called once per frame
@TheCuttlefish
TheCuttlefish / TurnObject_delayOrder.cs
Created February 4, 2020 14:12
Turn on/off an array of objects with delay
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TurnObject_delayOrder : MonoBehaviour
{
public List<GameObject> objects = new List<GameObject>();
public bool hideOnStart = false;
public float delay;
@TheCuttlefish
TheCuttlefish / .cs
Created February 15, 2020 01:10
Particles + Arrays
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GridMaker : MonoBehaviour
{
public GameObject square;
public List<GameObject> squares = new List<GameObject>();
@TheCuttlefish
TheCuttlefish / Boid.cs
Last active May 18, 2020 04:19
Flocking behavior
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Boid : MonoBehaviour
{
public List<GameObject> boids = new List<GameObject>();
Rigidbody rb;
void Start()
@TheCuttlefish
TheCuttlefish / MazeGen.cs
Created March 19, 2020 18:31
Maze gen -based on Game of Life 1970- accidental discovery
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MazeGen : MonoBehaviour
{
public GameObject cellSprite;
public bool[,] grid, nextGen;
public GameObject[,] sprites;
public int total;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
public class MosGen : MonoBehaviour
{
public GameObject cube;
public GameObject cellSprite;
public bool[,] grid, nextGen;
@TheCuttlefish
TheCuttlefish / GameOfLife.cs
Created March 21, 2020 00:19
GOL-1970 (Zhan Version)
using UnityEngine;
public class GameOfLife : MonoBehaviour
{
public GameObject cellPrefab;
public GameObject[,] cellSprites;
public int width = 10;
private bool[,] gen;
private bool[,] newGen;
@TheCuttlefish
TheCuttlefish / CamZoom.cs
Created April 15, 2020 13:58
lerp function
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CamZoom : MonoBehaviour
{
bool isNear = false;
float camSize = 5;
@TheCuttlefish
TheCuttlefish / TrailControl.cs
Created April 17, 2020 13:18
trail control
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ControlTrail : MonoBehaviour
{
public TrailRenderer myTrail;
bool showTrail = false;
void Update()