Skip to content

Instantly share code, notes, and snippets.

View mandarinx's full-sized avatar

Thomas Viktil mandarinx

View GitHub Profile
@mandarinx
mandarinx / Despawner.cs
Created June 15, 2022 10:04
Spawning despawning
using UnityEngine;
using System.Collections;
using UnityEngine.UIElements;
public class Despawner : MonoBehaviour {
public Manager manager;
private void Update() {
if (!Input.GetMouseButtonUp(1)) {
@mandarinx
mandarinx / Outline.shader
Created March 28, 2022 07:48 — forked from ScottJDaley/Outline.shader
Wide Outlines Renderer Feature for URP and ECS/DOTS/Hybrid Renderer
// Original shader by @bgolus, modified slightly by @alexanderameye for URP, modified slightly more
// by @gravitonpunch for ECS/DOTS/HybridRenderer.
// https://twitter.com/bgolus
// https://medium.com/@bgolus/the-quest-for-very-wide-outlines-ba82ed442cd9
// https://alexanderameye.github.io/
// https://twitter.com/alexanderameye/status/1332286868222775298
Shader "Hidden/Outline"
{
Properties
@mandarinx
mandarinx / ActionTrigger.cs
Created March 14, 2022 08:18
Unity Action Trigger
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ActionTrigger : MonoBehaviour
{
public enum TriggerType
{
None,
Start,
@mandarinx
mandarinx / VisualizeSunTable.cs
Last active October 22, 2022 00:00
Visualize SunTable
using Splines.Habrador;
using Telia.Core;
using Telia.Environment;
using UnityEngine;
public class VisualizeSunTable : MonoBehaviour
{
[Min(1f)] public float length;
public Material lineMat;
@mandarinx
mandarinx / SunTable.cs
Created February 2, 2021 19:47
[OC] Visualising sunrise and sunset for every day of the year
using System.Collections.Generic;
using UnityEngine;
namespace Stuff {
public class Day {
public int month;
public int day;
public Day(int p_month, int p_day) {
@mandarinx
mandarinx / Explosions.cs
Created March 19, 2020 21:03
Explosion system
//#define LOG
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using AptGames;
using TerrorSquid.BulletSystem;
using UnityEngine;
@mandarinx
mandarinx / Bullets.cs
Created March 19, 2020 20:52
Bullet system
//#define LOG_BULLETS
//#define OUTOFBOUNDS
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using TerrorSquid.Configs;
using UnityEngine;
using UnityEngine.Rendering;
@mandarinx
mandarinx / CoordsRadius.cs
Created October 31, 2019 09:12
Spatial partitioning
using UnityEngine;
namespace TerrorSquid.Collisions {
public static class CoordsRadius1 {
public static readonly Vector3[] coords = {
new Vector3(-1, -1, -1).normalized,
new Vector3(0, -1, -1).normalized,
new Vector3(1, -1, -1).normalized,
new Vector3(-1, -1, 0).normalized,
@mandarinx
mandarinx / DistortAura.shader
Created October 30, 2018 19:35
Distort aura shader
Shader "Sprite/Distort Aura" {
Properties{
[PerRendererData] _MainTex("Sprite Texture", 2D) = "white" {}
_Distort("Distort Texture", 2D) = "grey" {}
_Color("Color", Color) = (1, 0, 1, 1)
_Offset("Offset", Range(-4,10)) = 0
_Multiplier("Sprite Multiplier", Range(-2,2)) = 1
_Scale("Distort Scale", Range(0,10)) = 3.2
_SpeedX("Speed X", Range(-10,10)) = 2
_SpeedY("Speed Y", Range(-10,10)) = -3.2
@mandarinx
mandarinx / TestStateMachine.cs
Created August 24, 2018 08:42
Example of a simple state machine
using System;
using System.Collections.Generic;
using UnityEngine;
public enum State {
Idle = 0,
InMenu = 1,
InGame = 2,
InGameMuffled = 3,
EndGame = 4,