Skip to content

Instantly share code, notes, and snippets.

View g0ody's full-sized avatar
🎯
Focusing

Dominik Go g0ody

🎯
Focusing
  • Platogo
  • Austria
View GitHub Profile
@g0ody
g0ody / CharacterStateSender.cs
Created June 5, 2013 12:45
Unity3D 2DPlatformController (Plugin) States to PlayMaker (Plugin) Events
using UnityEngine;
using System.Collections.Generic;
using System;
using HutongGames.PlayMaker;
using HutongGames.PlayMaker.Actions;
/// <summary>
/// Logs the animation state to the console.
/// </summary>
public class CharacterStateSender : MonoBehaviour {
@g0ody
g0ody / ControllerSwipe.cs
Created May 10, 2013 12:08
Script for Swipe detection, uses Playmaker to Fire Events
using UnityEngine;
using System.Collections;
using HutongGames.PlayMaker;
public class ControllerSwipe : MonoBehaviour {
public float comfortZone = 70.0f;
public float minSwipeDist = 14.0f;
public float maxSwipeTime = 0.5f;
public float fastSwipeReaction = 15f;
@g0ody
g0ody / Curved.shader
Last active January 29, 2021 17:33
A Shader to make everything cruved in Unity3D
Shader "Platogo/Curved" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
_QOffset ("Offset", Vector) = (0,0,0,0)
_Dist ("Distance", Float) = 100.0
}
SubShader {
Tags { "RenderType"="Opaque" }
Pass
{
@g0ody
g0ody / CallbackService.js
Created April 25, 2013 07:34
Angularjs Callback Service (Method Chaining and Custom Callbacks)
/*global _, angular */
/*
function send() {
var cb = new Callback("custom");
SomeService.Send(cb.triggerSuccess, cb.triggerError, cb.triggerCustom);
return cb.remote();
}
send()
@g0ody
g0ody / gist:5386237
Created April 15, 2013 06:59
Lawnchair Service for AngularJS
Services.factory("LawnchairFactory", function($window, $log, $parse) {
return function(name, config) {
var collection = {};
var array = [];
var isArray = config && config.isArray;
var idGetter = $parse((config && config.entryKey) ? config.entryKey : "id");
var transformSave = (config && config.transformSave) ? config.transformSave : angular.identity;
var transformLoad = (config && config.transformLoad) ? config.transformLoad : angular.identity;
function getEntryId(entry){
@g0ody
g0ody / gist:5300406
Last active December 15, 2015 17:59
Cordova 2.5 iOS open http/https/mailto/fb urls external Add this to MainViewController.m
- (BOOL)webView:(UIWebView *)theWebView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
NSURL *url = [request URL]; // URL that was requested
NSLog(@"OpenUrl: %@", [request URL]);
// Test that URL scheme is either HTTP(S)
if ([[url scheme] isEqualToString:@"http"] || [[url scheme] isEqualToString:@"https"] || [[url scheme] isEqualToString:@"fb"] || [[url scheme] isEqualToString:@"mailto"]) {
[[UIApplication sharedApplication] openURL:url]; // forward to application router
return NO;
}
else {
@g0ody
g0ody / JSONTool.cs
Created April 3, 2013 09:23
Unity3D Editor Tool to save Settings of GameObjects into a file. Depends on: MiniJSON(https://gist.github.com/darktable/1411710) SerializeUtility(https://gist.github.com/g0ody/5299674)
using UnityEditor;
using UnityEngine;
using System.IO;
using System.Collections;
using System;
public class JSONTool : EditorWindow
{
[MenuItem("Platogo/JSON Tool")]
public static void Init()
@g0ody
g0ody / SerializeUtility.cs
Last active December 15, 2015 17:50
Serializer Class for Unity3D to Convert MonoBehaviour Objects in Hashtables, which can be parsed to JSON or XML *Serializes only the first MonoBehaviour of each GameObject, and loops through Children*
using UnityEngine;
using System.Collections.Generic;
using System.Collections;
using System.Reflection;
using System;
public class SerializeUtility
{
public static ArrayList ArrayToArrayList<T, U>(T[] data, Converter<T, U> converter)
{
@g0ody
g0ody / gist:5299480
Last active December 15, 2015 17:49
Numeric 9 Key not working in Cordova 2.5. Copy this in your Android Project Main File. in platforms/android/src/com/sample/project/app.java
// ADD IMPORTS:
// import android.webkit.WebSettings;
// import java.lang.reflect.Method;
// import java.lang.reflect.InvocationTargetException;
@Override
public void init() {
super.init();
try {