Skip to content

Instantly share code, notes, and snippets.

View GarethIW's full-sized avatar
💾

Gareth Williams GarethIW

💾
View GitHub Profile
@GarethIW
GarethIW / PlayerData.cs
Last active December 19, 2023 19:23
Simple SO/Json data stuff
public class PlayerData
{
public string Name;
public Vector3 Position;
public int Coins;
}
@GarethIW
GarethIW / 1-mirrors.md
Last active April 28, 2023 07:53
Legend of Etad Hints

Chapter 1: The Light/Mirror Puzzle Dungeon

Hint 1 There are two types of mirror: vertical and horizontal. They can only be placed on appropriate pedestals.
Hint 2 All the mirrors you need are in the dungeon. You can't mess it up by e.g. doing one room before another. The first two puzzle rooms are tutorials, the third puzzle involves a series of rooms.
import "CoreLibs/graphics"
import "CoreLibs/crank"
local numFrames=55
local frames={}
local currentFrame=1
playdate.display.setRefreshRate(50)
for i=1,numFrames do
@GarethIW
GarethIW / Exporter.cs
Created April 17, 2022 19:56
Playdate RPG exporter
public class Exporter : MonoBehaviour
{
public Material[] GroundMaterials;
public Material[] WallMaterials;
public GameObject[] Walls;
public GameObject Ceiling;
public GameObject Floor;
@GarethIW
GarethIW / MainCamera.cs
Last active March 24, 2022 08:24
Unity camera script for following and clamping to multiple players
public class MainCamera : MonoBehaviour
{
public Transform[] Players;
public Vector3 Target;
public Vector3 BaseOffset;
public float Speed;
public float YZoomFactor;
public float ZZoomFactor;
@GarethIW
GarethIW / Constructor.cs
Created March 25, 2019 08:27
Constructor with step
/////////////////////////////////////////////////////////////////////////
//
// PicaVoxel - The tiny voxel engine for Unity - http://picavoxel.com
// By Gareth Williams - @garethiw - http://gareth.pw
//
// Source code distributed under standard Asset Store licence:
// http://unity3d.com/legal/as_terms
//
/////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
//
// PicaVoxel - The tiny voxel engine for Unity - http://picavoxel.com
// By Gareth Williams - @garethiw - http://gareth.pw
//
// Source code distributed under standard Asset Store licence:
// http://unity3d.com/legal/as_terms
//
/////////////////////////////////////////////////////////////////////////
using System;
public class Singleton : MonoBehavior
{
private static Singleton _instance;
public static Singleton Instance
{
get { return _instance; }
}
private void Awake()
public class MainCamera : MonoBehaviour
{
public Transform[] Players;
public Vector3 Target;
public Vector3 BaseOffset;
public float Speed;
public float YZoomFactor;
public float ZZoomFactor;
@GarethIW
GarethIW / PicaVoxel 1.4 Changelist
Last active September 24, 2016 18:18
PicaVoxel 1.4 Changelist
FEATURE: Voxel state now uses an enum with three statuses: Inactive, Active, and Hidden. When voxels are destroyed at runtime,
their state gets set to Hidden. Rebuild() method on Volume/Frame restores the destroyed voxels.
FEATURE: Marching cubes meshing mode. Looks like the Marching rendering mode in MagicaVoxel.
FEATURE: Customizable chunk size per volume, with non-cubic sizes supported up to 16*16*16 voxels.
FEATURE: Mesh Scanner. Convert a 3D model to a PicaVoxel volume.
FEATURE: Image import. Convert a PNG or JPG image to a voxel volume, with alpha cutout (or custom colour cutout) and optional