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
// yay! using statements! | |
using UnityEngine; | |
using System.Collections; | |
// this is pish posh class stuff! | |
public class SpriteChangeExample : MonoBehaviour { | |
// we create a variable to store our sprite renderer for easy referencing and set to empty/null. | |
private SpriteRenderer thisSprite = null; | |
// we now create a variable for our polygon collider so our sprite has a neat new 2dcollider that fits comfortably! |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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 SimplexNoiseGenerator { | |
private int[] A = new int[3]; | |
private float s, u, v, w; | |
private int i, j, k; | |
private float onethird = 0.333333333f; | |
private float onesixth = 0.166666667f; | |
private int[] T; |
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 static class Screenshot | |
{ | |
private static string GetTimestamp () { | |
System.DateTime dateTime = System.DateTime.Now; | |
return dateTime.ToString("yyyyMMddHHmmss"); | |
} |
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 ScreenManager : MonoBehaviour | |
{ | |
// mouse position in screen cordinates. | |
public Vector3 screenPosition; | |
// mouse position in world space. | |
public Vector3 worldPosition; | |
// Bounds of the screen in world space. |
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 ObjectViewer : MonoBehaviour { | |
// Object or Transform which we want to rotate | |
public Transform targetObject; | |
// these are the import but hush hush settings for the rotation properties | |
public RotationProperties rotationProperties; |
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 CameraShake : MonoBehaviour{ | |
private static Vector3 originPosition; | |
private static Quaternion originRotation; | |
private static float shakeDecay = 0.002f; | |
private static float shakeIntensity; |
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; | |
using System.Collections.Generic; | |
public class MultiplayerServer: MonoBehaviour | |
{ | |
// Server Settings | |
public int maxPlayers = 11; | |
// Player Settings |
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
public static bool Sight (Vector3 target, Vector3 myPos, Vector3 myViewDir, float myViewDist, float myViewAng) { | |
bool res = false; | |
float ang = Vector2.Angle(DirGet2D(myPos, target), VecGet2D(myViewDir)); | |
if (ang <= (myViewAng/2f)) { | |
if (DistGet2D(myPos, target) < myViewDist) | |
res = true; | |
} | |
return res; | |
} | |
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
// Sean Loper | |
// I use a template so any combination can be used, logically. | |
// Every X is replaced by a random character while 9 is replaced by a random number! | |
function randomKey() | |
{ | |
$template = 'XX99-XX99-99XX-99XX-XXXX-99XX'; | |
$k = strlen($template); | |
$sernum = ''; | |
for ($i=0; $i<$k; $i++) | |
{ |
OlderNewer