Skip to content

Instantly share code, notes, and snippets.

View z3t0's full-sized avatar

Rafi Khan z3t0

View GitHub Profile
@z3t0
z3t0 / a.cs
Last active July 3, 2016 23:12
void LoadMod(string mpath, string json) {
Debug.Log("Trying to load mod at '" + mpath + "'");
// Load JSON
ReadTextFile reader = new ReadTextFile();
string jsonSource = reader.Read(json);
Debug.Log(jsonSource);
string ax = JsonConvert.DeserializeObject<string>(jsonSource);
loader.destroyInstance = (object instance) => DestroyObject (instance);
public void DestroyObject(object instance) {
if (instance is Component)
Destroy (instance as Component);
}
loader.createInstance = (Type t) =>
{
string fileName = t.ToString() + ".cs";
Debug.Log(t.GetType());
foreach (var mod in modLoader.mods) {
string modPath = mod.path + "/Scripts/";
foreach (var script in mod.scripts) {
string shortPath = script.Substring(modPath.Length);
if(shortPath == fileName) {
Debug.Log("found a match: '" + fileName + "' is from Mod: '" + mod.name + "'");
loader.createInstance = (Type t) =>
{
bool found = false;
string fileName = t.ToString() + ".cs";
foreach (var mod in modLoader.mods) {
string modPath = mod.path + "/Scripts/";
foreach (var script in mod.scripts) {
string shortPath = script.Substring(modPath.Length);
if(shortPath == fileName) {
if(typeof(Component).IsAssignableFrom(t)){
@z3t0
z3t0 / example.cs
Created July 9, 2016 20:46
This sets the Transform of the new gameobject to RectTransform
consoleView = new GameObject();
consoleView.layer = 5; // UI
consoleView.name = "ConsoleView";
Arduino: 1.6.9 (Windows 10), Board: "ATtiny x313 series, ATtiny2313, 1 MHz (internal), B.O.D. Disabled, no"
Build options changed, rebuilding all
In file included from C:\arduino-1.6.9\libraries\IRremote\IRremote.h:24:0,
from C:\arduino-1.6.9\libraries\IRremote\irRecv.cpp:1:
C:\arduino-1.6.9\libraries\IRremote\irRecv.cpp: In member function 'void IRrecv::enableIRIn()':
Type GetType(string name)
{
foreach(KeyValuePair<string, Type> script in scripts)
{
if(script.Key == name)
{
return script.Value;
}
}
#include <ctime>
#include <iostream>
#include <string>
#include <boost/array.hpp>
#include <boost/bind.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/asio.hpp>
using boost::asio::ip::udp;
var client = require('./client.js')('127.0.0.1', 3000);
client.sendMessage("new_player");
if (Input.touchCount > 0) {
Ray touchray = Camera.main.ScreenPointToRay (Input.GetTouch (0).position);
Debug.DrawRay (touchray.origin, touchray.direction, Color.yellow, 5.0f);
}
Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);
Debug.DrawRay (ray.origin, ray.direction, Color.green, 5.0f);