Skip to content

Instantly share code, notes, and snippets.

# Groups are started by a header line containing the group name enclosed in '[' and ']',
# and ended implicitly by the start of the next group or the end of the file.
# The group common contains features common to all devices, the remaining groups are devices associated with the platform.
# If feature.available=value does not exist its value will be assumed as false by default.
# For example audio.available key not existing means that there is no audio available.
[common]
screen.available=true
screen.dpi=212
screen.resolution.width=758
screen.resolution.height=1024
using System;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace PvpGame
{
public class GridValue
{
public enum EntityType
/*
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.
*/
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace PvpGame
{
public sealed class Objectpool2<T>
where T : new()
{
@twobob
twobob / HashCache.js
Created February 18, 2016 20:13 — forked from stamat/HashCache.js
A hash table value value storage for quick seek in large lists of big objects/arrays/strings. It uses CRC32 algorithm to convert supplied values into integer hashes and produce more elegant solution escaping data redundancy and heavy memory loads but also leaning on native hash map implementation for seek speed and optimization.
/**
* A hash table value value storage for quick seek in large lists of big objects/arrays/strings.
* It uses CRC32 algorithm to convert supplied values into integer hashes and produce more elegant solution escaping data redundancy and heavy memory loads but also leaning on native hash map implementation for seek speed and optimization.
*
* @author Nikola Stamatovic Stamat < [email protected] >
* @copyright ivartech < http://ivartech.com >
* @version 1.0
* @date 2013-07-02
* @namespace ivar.data
*/
void GetComponentsInChildrenRecursive<T> (Transform parent, List<T> buffer)
where T : Component
{
foreach (Transform t in parent) {
var c = t.GetComponent<T> ();
if (c) {
buffer.Add (c);
}
GetComponentsInChildrenRecursive (t, buffer);
}
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
public class CreateMergedMesh : ScriptableWizard
{
[MenuItem ("Prototype/Create Merged Mesh")]
static void CreateDataMesh ()
{
@twobob
twobob / StateMachine.cs
Created April 15, 2017 03:01 — forked from mstevenson/StateMachine.cs
Untested off-the-cuff example of a possible method-based state machine design for Unity.
// Defines the required parameters and return value type for a StateMachine state.
// Returns a bool representing whether or not the state has finished running.
public delegate bool StateDelegate ();
// To use, create an instance of StateMachine inside of a MonoBehaviour, load it up with
// references to state methods with ChangeState(), then call its Execute() method during the
// MonoBehaviour's Update cycle. An example MonoBehaviour is included at the bottom of this file.
public class StateMachine
{
// Keep track of the currently running state
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.IO;
public class FileUtility {
/// <summary>
/// Determine whether a given path is a directory.
/// </summary>
@twobob
twobob / ShuffleBag.cs
Created April 15, 2017 03:03 — forked from mstevenson/ShuffleBag.cs
Shuffle bag algorithm implemented in C#
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class ShuffleBag<T> : ICollection<T>, IList<T>
{
private List<T> data = new List<T> ();
private int cursor = 0;
private T last;