Skip to content

Instantly share code, notes, and snippets.

struct BoolSet
{
public bool[,] data;
public bool Contains(Vector3 c) => data[(int)c.x + 300, (int)c.y + 300];
public void Clear() => data = new bool[600, 600];
public void Put(Vector3 c)
{
c = new Vector3(Mathf.Floor(c.x), Mathf.Floor(c.y));
data[(int)c.x + 300, (int)c.y + 300] = true;
@TeoPara
TeoPara / SerializerNetBehaviour.cs
Last active April 9, 2026 18:04
Mirror RPC Serialization
using System;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using Mirror;
using UnityEngine;
// Attach this component to any GameObject
public class SerializerNetBehaviour : NetworkBehaviour
{
public static SerializerNetBehaviour refer;
@TeoPara
TeoPara / HeightSystem.cs
Created November 5, 2023 20:27
A "height" system I made for Unity 2d topdown game. It lets me call an extension function on any object, that object will have a shadow parented to it that changes as I modify the object's height. Behaviour is different depending on the type of object.
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
public static class HeightSystem
{
static readonly List<Instance> All = new();
public static float GetHeight(this MonoBehaviour target) =>