Skip to content

Instantly share code, notes, and snippets.

@N-Carter
N-Carter / inventory_panel.gd
Created May 27, 2022 16:14
Inventory from Depths
class_name InventoryPanel
extends PopupDialog
export var item_slot_scene : PackedScene
export var scroll : NodePath
onready var scroll_node : ScrollContainer = get_node(scroll)
export var grid : NodePath
extends KinematicBody2D
export(float) var speed := 8.0
export(float) var jump_impulse := 200.0
export(float) var max_speed := 200.0
export(float) var gravity_multiplier := 1.0
export(float) var snap_length := 5.0
export(float) var floor_damping := 200.0
@N-Carter
N-Carter / grid_focus_connector.gd
Created December 20, 2021 13:02
Focus Connecting script for Godot's GridContainer
extends GridContainer
export var connect_on_ready : bool
func _ready() -> void:
if connect_on_ready:
connect_children()
@N-Carter
N-Carter / EditorGUITools.cs
Created February 6, 2017 20:06
EditorGUITools
using UnityEngine;
using UnityEditor;
using System.Collections;
public class EditorGUITools : GUITools
{
public static void DrawOutlineRect(Rect rect)
{
DrawHorizontalLine(new Vector2(rect.x, rect.y), rect.width);
DrawVerticalLine(new Vector2(rect.x, rect.y), rect.height);
@N-Carter
N-Carter / TerrainGenerator.cs
Created August 29, 2016 12:10
A simple terrain generator for Unity. The noise function comes from here: https://code.google.com/p/simplexnoise/source/browse/trunk/SimplexNoise/Noise.cs
using UnityEngine;
using System.Collections;
using System.Threading;
using SimplexNoise;
public class TerrainGenerator : MonoBehaviour
{
[SerializeField] protected int m_Size = 512; // TODO: Require PoT sizes
[SerializeField] protected float m_Height = 32.0f;
@N-Carter
N-Carter / OutlineMesh.cs
Created August 3, 2015 19:48
Experimental code to draw an convex outline around a mesh.
/*
** OutlineMesh.cs
*/
//#define DEBUG
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
@N-Carter
N-Carter / FontEditor.cs
Created February 1, 2015 18:29
Custom editor for Unity Font objects.
using UnityEngine;
using UnityEditor;
using System.Collections;
[CustomEditor(typeof(Font))]
public class FontEditor : Editor
{
Font m_Font;
static bool m_TilingControlsVisible;
@N-Carter
N-Carter / Triangulator.cs
Created December 22, 2014 22:59
Triangulator
// Author: runevision
// URL: http://wiki.unity3d.com/index.php?title=Triangulator
// Version: http://wiki.unity3d.com/index.php?title=Triangulator&oldid=14208
//
// Then modified a bit. -NC
using UnityEngine;
using System.Collections.Generic;
using System.Linq;
@N-Carter
N-Carter / SpatialCutoffTest.shader
Created September 10, 2014 22:29
Spatial Cutoff Test shader
// Upgrade NOTE: replaced 'PositionFog()' with multiply of UNITY_MATRIX_MVP by position
// Upgrade NOTE: replaced 'V2F_POS_FOG' with 'float4 pos : SV_POSITION'
// Upgrade NOTE: replaced 'glstate.matrix.projection' with 'UNITY_MATRIX_P'
Shader "Mine/Spatial Cutoff Test"
{
Properties
{
_Color ("Main Color", Color) = (1,1,1,1)
@N-Carter
N-Carter / Makefile
Created September 10, 2014 10:40
/usr/lib/python2.7/config/Makefile from Mavericks
# Generated automatically from Makefile.pre by makesetup.
# Top-level Makefile for Python
#
# As distributed, this file is called Makefile.pre.in; it is processed
# into the real Makefile by running the script ./configure, which
# replaces things like @spam@ with values appropriate for your system.
# This means that if you edit Makefile, your changes get lost the next
# time you run the configure script. Ideally, you can do:
#
# ./configure