Skip to content

Instantly share code, notes, and snippets.

@gamemachine
gamemachine / gist:51c4af5cd0a3e1f8fd56
Created Jul 26, 2014
Unity Scene exporter for navigation meshes
View gist:51c4af5cd0a3e1f8fd56
/*
Based on EditorObjExporter.cs and TerrainObjExporter. Exports the current terrain plus selected objects to a single wavefront .obj file.
The approach is to not invert the x axis, as negatives mess with pathfinding libraries like recastnavigation. Instead we swap x and z on everything,
which works perfectly for pathfinding. With recast we just have to swap x and z on the vectors that we give it and get back from it.
This should be put in your "Editor"-folder. Use by selecting the objects you want to export, and select
"Custom->Export Scene" which will export to for_navmesh.obj in the root of your unity project.
*/
View grid_tracking
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace PvpGame
{
public sealed class Objectpool2<T>
where T : new()
{
View gist:e1ed822440dd45f1e4c9
{
'id' => 'ship',
'item1' => 'wood',
'item1_quantity' => 2,
'item2' => 'iron_ore',
'item2_quantity' => 2
},
{
'id' => 'pier',
'item1' => 'wood',
@gamemachine
gamemachine / gist:1861191
Created Feb 18, 2012
jruby yaml parsing backtrace
View gist:1861191
java.lang.System.arraycopy(Native Method)
org.yecht.IoStrRead$Default.read(IoStrRead.java:38)
org.yecht.Parser.read(Parser.java:247)
org.yecht.TokenScanner.real_yylex(TokenScanner.java:222)
org.yecht.TokenScanner.advance(TokenScanner.java:51)
org.yecht.DefaultYAMLParser.yyparse(DefaultYAMLParser.java:312)
org.yecht.Parser.yechtparse(Parser.java:290)
org.yecht.Parser.parse(Parser.java:284)
View gist:3660841
"Entities":[
{
"key": "ent1",
"entities": ["ent2", "ent3"],
"Components": [
{
"key": "disp1",
"name": "Rage Punch",
"icon_asset": "rage.png",
"type": "display"
View AnimationController.cs
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace GameMachine {
namespace Animation {
public class AnimationController2 : MonoBehaviour {
public enum Layer {
Base,
View GridValue.cs
/*
This software is licensed under the Apache 2 license, quoted below.
Copyright 2014 Game Machine.
Copyright 2014 Chris Ochs <chris @ochsnet.com>
Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy of
the License at
View gist:7113668
using System.Net;
using System.Net.Sockets;
using System;
using System.Text;
using System.Collections.Generic;
using System.IO;
using System.Net.Http;
public class Client
{
View gist:7113886
T 2013/10/22 23:43:32.686548 127.0.0.1:38695 -> 127.0.0.1:80 [AP]
GET /doc/index.html HTTP/1.1.
Connection: keep-alive.
Host: 127.0.0.1.
.
T 2013/10/22 23:43:32.686611 127.0.0.1:80 -> 127.0.0.1:38695 [AP]
HTTP/1.1 200 OK.
Server: nginx/1.4.1 (Ubuntu).
@gamemachine
gamemachine / ItemCatalog.cs
Created Sep 12, 2015
Scriptablable object as protobuf message container
View ItemCatalog.cs
using UnityEngine;
using io.gamemachine.messages;
namespace GameMachine {
namespace ItemManagement {
[CreateAssetMenu(menuName =@"ItemCatalog")]
public class ItemCatalog : ScriptableProtobuf<PlayerItems> {
}
}