This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class NaturalOrientation : MonoBehaviour { | |
public static int ORIENTATION_UNDEFINED = 0x00000000; | |
public static int ORIENTATION_PORTRAIT = 0x00000001; | |
public static int ORIENTATION_LANDSCAPE = 0x00000002; | |
public static int ROTATION_0 = 0x00000000; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import struct | |
import SocketServer | |
from base64 import b64encode | |
from hashlib import sha1 | |
from mimetools import Message | |
from StringIO import StringIO | |
class WebSocketsHandler(SocketServer.StreamRequestHandler): | |
magic = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sendError(message, url, lineNum) { | |
var i; | |
// First check the URL and line number of the error | |
url = url || window.location.href; | |
lineNum = lineNum || 'None'; | |
// If the error is from these 3rd party script URLs, we ignore | |
// We could also just ignore errors from all scripts that aren't our own | |
var scriptURLs = [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible). | |
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export. | |
var FORMAT_ONELINE = 'One-line'; | |
var FORMAT_MULTILINE = 'Multi-line'; | |
var FORMAT_PRETTY = 'Pretty'; | |
var LANGUAGE_JS = 'JavaScript'; | |
var LANGUAGE_PYTHON = 'Python'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shader "Mobile/Ambient Diffuse Detail" { | |
Properties { | |
_Color ("Main Color", Color) = (1,1,1,1) | |
_MainTex ("Base (RGB)", 2D) = "white" {} | |
_Detail ("Detail (RGB)", 2D) = "gray" {} | |
} | |
SubShader { | |
Pass{ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Drop this script in the Editor directory in your project (creating the Editor directory if it's not there yet) | |
// Then re-import the assets in the directories covered by this script (right click and reimport) | |
// | |
// I would replace my path checking with the path checking from this gist: | |
// https://gist.github.com/1842177 | |
// | |
// The texture settings for icons might want to use some of his settings combined with mine as well | |
using UnityEngine; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
// copied and modified from http://webstaff.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf | |
public class SimplexNoise { // Simplex noise in 2D, 3D and 4D | |
private static int[][] grad3 = new int[][] { | |
new int[] {1,1,0}, new int[] {-1,1,0}, new int[] {1,-1,0}, new int[] {-1,-1,0}, | |
new int[] {1,0,1}, new int[] {-1,0,1}, new int[] {1,0,-1}, new int[] {-1,0,-1}, | |
new int[] {0,1,1}, new int[] {0,-1,1}, new int[] {0,1,-1}, new int[] {0,-1,-1}}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class LinkObject { | |
public LinkObject prev = null; | |
public LinkObject next = null; | |
public GameObject data; | |
public LinkObject(GameObject link) { | |
data = link; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO//.Ports; | |
using System.Collections; | |
using System.Net; | |
using System.Net.Sockets; | |
using System.Threading; | |
using UnityEngine; | |
/// <summary> | |
/// UdpPacket provides packetIO over UDP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Converts Mobile Touch to the default Mouse Click | |
## invoked these method in Mobile too | |
OnMouseDown | |
OnMouseDrag | |
OnMouseUp | |
## only called in touch screen |