This file contains hidden or 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; | |
using System.Collections.Generic; | |
using Newtonsoft.Json; | |
using UnityEngine; | |
using UnityEngine.Networking; | |
namespace HDZD { | |
public static class HttpRequests { | |
private static CoroutineRunner _routineRunner = null; |
This file contains hidden or 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
class StateMachine { | |
constructor(logger) { | |
this.currentState = null; | |
this.states = {}; | |
this.Logger = logger; | |
} | |
AddState(context, stateName, onEnter = null, tick = null, onExit = null, isEntry = false) { | |
this.states[stateName] = | |
{ |
This file contains hidden or 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.Collections.Generic; | |
using UnityEngine; | |
namespace HDZD | |
{ | |
//Maze generation using a DFS approach to carve a path in a completely closed Maze | |
public class DfsMazeGenerator | |
{ | |
private static int[] _dx = { -1, 0, 1, 0 }; | |
private static int[] _dy = { 0, -1, 0, 1 }; |
This file contains hidden or 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; | |
namespace HDZD | |
{ | |
class SpatialHashGrid <T> | |
{ | |
private Vector3 m_cellSizeUnit; | |
private Dictionary<Vector3I, HashSet<ItemProxy>> m_objectGrid = new Dictionary<Vector3I, HashSet<ItemProxy>>(); |
This file contains hidden or 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; | |
using UnityEngine; | |
using System.Runtime.Serialization.Formatters.Binary; | |
using System.IO; | |
public class SaveManager : MonoBehaviour { | |
//Structure your save file here | |
[Serializable] | |
public class SaveFile { |
This file contains hidden or 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.Collections.Generic; | |
public class SafeDictionary<A,B> : Dictionary<A,B> | |
{ | |
public new B this[A key] { | |
get { | |
if (TryGetValue(key,out B value)) | |
return value; | |
return default; |
This file contains hidden or 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.Collections.Generic; | |
namespace StateManagment { | |
public class StateMachine <T> { | |
private Dictionary <T,State> states; | |
private Dictionary <T,List <Transition>> transitions; | |
private State currentState = null; | |
public StateMachine() { | |
states = new Dictionary<T, State>(); |
This file contains hidden or 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.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEngine.SceneManagement; | |
public class Pooler : MonoBehaviour { | |
private static Dictionary<string,UniqueQueue<GameObject>> _queueMap; | |
private static Dictionary<string,UniqueQueue<GameObject>> queueMap{ | |
get { | |
if (_queueMap == null){ |
This file contains hidden or 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.Collections.Generic; | |
public class UniqueQueue <T> { | |
Queue <T> queue; | |
HashSet <T> set; | |
public int Count{ | |
get { | |
return queue.Count; | |
} |
This file contains hidden or 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.Collections; | |
using System.Collections.Generic; | |
public class RingBuffer <T> { | |
private int maxSize; | |
private T[] data; | |
private int headIndex; | |
private int currentIndex; | |
private int currentSize; |