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; | |
[RequireComponent(typeof(AudioSource))] | |
public class SoundPOC : MonoBehaviour | |
{ | |
FContainer container; | |
CBox greenbox; | |
bool started = false; |
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
boolean isValid = true; | |
if (isValid && expensiveCheck1()) { ... } | |
if (isValid && expensiveCheck2()) { ... } | |
// expensiveCheck1() and expensiveCheck2() should set isValid = false if needed to short circuit rest of validations |
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
[Ll]ibrary/ | |
[Tt]emp/ | |
[Oo]bj/ | |
[Bb]uild/ | |
# Autogenerated VS/MD solution and project files | |
/*.csproj | |
/*.unityproj | |
/*.sln | |
/*.suo |
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.Collections.Generic; | |
// from https://github.com/adonaac/blog/issues/1 | |
public class DungeonGenerator | |
{ | |
/** GRID OF CELLS **/ | |
private Cell[,] grid; | |
private int gridWidth, gridHeight; // of grid |
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.Collections.Generic; | |
// from https://github.com/adonaac/blog/issues/1 | |
public class DungeonGenerator | |
{ | |
/** GRID OF CELLS **/ | |
private Cell[,] grid; | |
private int gridWidth, gridHeight; // of grid |
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
/* | |
a 2D array can easily be represented by a standard array. given an array that has a size equal to a square number, | |
reverse the order of the "rows" into a new array without changing the order of the elementes in each row. | |
example: | |
oldArray newArray | |
row 1 [0,1,2 row 3 [6,7,8 | |
row 2 3,4,5 --> row 2 3,4,5 | |
row 3 6,7,8] row 1 0,1,2] | |
*/ |
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
Vector2 pixelToTile (Vector2 mouseInput) { | |
//Tiles are what size? | |
if (tileSize == 0) { | |
tileSize = tileGrid[0][0].toUse.getWidth(); | |
} | |
int x = Math.floor(mouseInput.x / tileSize); | |
int y = Math.floor(mouseInput.y / tileSize); | |
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
foreach (Transform child in transform) { | |
child.parent = null; | |
child.collider2D.isTrigger = false; | |
child.rigidbody2D.isKinematic = false; | |
child.rigidbody2D.AddTorque(Random.Range(-torquePower, torquePower)); | |
child.rigidbody2D.AddForce(new Vector2(Random.Range(-.5f, .5f), 1.0f) * forcePower); | |
} |
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
select | |
* | |
from | |
people | |
where last_name in | |
( | |
select | |
distinct (last_name) | |
from | |
people |
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; | |
// gun sway based on lissajou curve | |
// formula found in example 3 of http://www.intmath.com/trigonometric-graphs/7-lissajous-figures.php | |
public class Lissajou : MonoBehaviour | |
{ | |
float local_X; | |
float local_Y; | |
float t = 0; |