Skip to content

Instantly share code, notes, and snippets.

@GibTreaty
GibTreaty / Block.cs
Created October 5, 2016 14:20
Voxel based world generation
using UnityEngine;
namespace YounGenTech.VoxelTech {
[System.Serializable]
public struct Block {
public static Block Empty { get { return new Block(0); } }
public static Block Air { get { return new Block(1); } }
public static Block Solid { get { return new Block(2); } }
@GibTreaty
GibTreaty / MathHelper.cs
Last active December 23, 2021 20:13
Contains many helper functions for integers, the VectorI structs and more
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
public static class MathHelper {
/// <summary>
/// Get which face of a rotated block will be on a side (face parameter)
/// </summary>
public static int GetRotatedFace(this int rotationIndex, int face) {
@GibTreaty
GibTreaty / Direction.cs
Last active October 5, 2016 14:06
A bunch of enums and helper function to aid in finding directions (originally used in a voxel system) (Requires the VectorI.cs)
using System;
using UnityEngine;
public enum Direction {
Left = 0,
Right = 1,
Bottom = 2, Down = 2,
Top = 3, Up = 3,
Backward = 4, Back = 4,
Forward = 5, Front = 5
@GibTreaty
GibTreaty / VectorI.cs
Created October 5, 2016 14:03
Integer Vector struct
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
[System.Serializable]
public struct VectorI3 {
#region Constants
public static VectorI3 back { get { return new VectorI3(0, 0, -1); } }
public static VectorI3 bottom { get { return new VectorI3(0, -1, 0); } }
@GibTreaty
GibTreaty / RadialLayout.cs
Created August 26, 2016 04:53 — forked from DGoodayle/RadialLayout.cs
Radial Layouts in Unity
using UnityEngine;
using UnityEngine.UI;
/*
Radial Layout Group by Just a Pixel (Danny Goodayle) - http://www.justapixel.co.uk
Copyright (c) 2015
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
@GibTreaty
GibTreaty / Joystick.cs
Last active July 17, 2017 02:27
Jostick
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Events;
using UnityEngine.EventSystems;
using System.Collections;
#if UNITY_EDITOR
using UnityEditor;
#endif