Skip to content

Instantly share code, notes, and snippets.

View paraself's full-sized avatar
🙆‍♂️
Coding

Yves Wang paraself

🙆‍♂️
Coding
View GitHub Profile
@paraself
paraself / machine.js
Last active February 27, 2020 11:42
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
/**
* Copyright (c) 2014-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var regeneratorRuntime = (function (exports) {
"use strict";
@paraself
paraself / Events.cs
Created August 29, 2016 07:17 — forked from wmiller/Events.cs
Unity3D Event System
using System.Collections;
using System.Collections.Generic;
public class GameEvent
{
}
public class Events
{
static Events instanceInternal = null;
@paraself
paraself / gist:c3fe55f333397319444dfd9cc48491a8
Last active August 4, 2016 10:24 — forked from Arakade/gist:9dd844c2f9c10e97e3d0
Call from OnDrawGizmos() to draw text at Unity3D glocal position in Editor
public static void DrawString(Camera cam,string text, Vector3 worldPos, Color? colour = null)
{
if (IsValidCamera (cam) == false)
return;
UnityEditor.Handles.BeginGUI();
Color c = GUI.color;
if (colour.HasValue) GUI.color = colour.Value;
var view = UnityEditor.SceneView.currentDrawingSceneView;
if (view==null) return;
@paraself
paraself / Easing.cs
Created August 1, 2016 15:58 — forked from Fonserbc/Easing.cs
Compact and simple easing functions for Unity
using UnityEngine;
/*
* Functions taken from Tween.js - Licensed under the MIT license
* at https://github.com/sole/tween.js
*/
public class Easing
{
public static float Linear (float k) {
@paraself
paraself / SyncedCameras
Last active May 23, 2016 06:20
Sync 2d Camera between scene view and game view. So whenever you pan your scene view by holding the middle mouse btn, the game view will always match its position to the scene view camera. However scene view's zoom in and out will not be taken into account. The ortho size of the game view camera will remain all the time. This is perfect for maki…
///Sync camera position between scene camera and the rendering camera
//Add [ExecuteInEditorMode] to your monobehaviour and add the following OnRenderObject method as well.
///...
[ExecuteInEditorMode]
//...
void OnRenderObject () {
cam = Camera.current;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
public class QueuedTask : Singleton<QueuedTask> {
const int MaxProcessCount = 2;
@paraself
paraself / gist:36b1730737656b5d3222
Created October 3, 2015 18:56 — forked from allanolivei/gist:8982445
Unity 3d : Expose the rendering order of MeshRenderer in the Unity3D
using UnityEngine;
using UnityEditor;
using System.Reflection;
using System;
using UnityEditorInternal;
[CustomEditor(typeof(MeshRenderer)), CanEditMultipleObjects]
public class MeshRendererInspector : Editor
{
@paraself
paraself / EditorPlayMode
Last active October 30, 2023 14:38
Unity Play Mode Detection
//originally adopted from
//http://answers.unity3d.com/questions/447701/event-for-unity-editor-pause-and-playstop-events.html
//with a few modifications which makes the event firing nicer and cleaner
//Usage Example :
//
//using UnityEditor;
//using UnityEngine;
//
//[InitializeOnLoad]
//public class SingleEntryPoint
@paraself
paraself / AUB_BLENDS.cginc
Created May 15, 2015 10:41
Photoshop Blends shader funcitons
//Source http://forum.unity3d.com/threads/free-photoshop-blends.121661/
#ifndef AUB_BLENDS_INCLUDED
#define AUB_BLENDS_INCLUDED
/**********************INCLUDES**********************/
/**********************STRUCTS**********************/
struct a2f_uv0 {
float4 vertex : POSITION;