This file contains 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
// Copyright (c) 2016 StagPoint Software | |
namespace StagPoint.Networking | |
{ | |
using System; | |
using UnityEngine; | |
using UnityEngine.Networking; | |
/// <summary> | |
/// Provides some commonly-used functions for transferring compressed data over the network using |
This file contains 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
// Copyright (c) 2016 StagPoint Software | |
// NOTE: C#-style unions (structs using FieldOffset to cause multiple fields to 'overlap' in memory) may not be allowed on | |
// some IL2CPP platforms? If you get a compile error related to using FieldOffset on your target platform, comment the | |
// following #define to force this code to use another method. | |
// | |
// The UnityEngine.Networking code on BitBucket uses (#if !INCLUDE_IL2CPP) to control whether to use unions, but that code | |
// may be out of date (Unity has so far failed to respond), but testing confirms that this method does work on at least one | |
// of the IL2CPP target platforms, so we've chosen a more explicit #define instead. | |
#define USE_UNION_FOR_CONVERSION |
This file contains 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 UnityEditor; | |
[InitializeOnLoad] | |
public class StopPlayingOnRecompile | |
{ | |
static StopPlayingOnRecompile() | |
{ | |
EditorApplication.update = () => | |
{ | |
if( EditorApplication.isCompiling ) |
This file contains 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
// Copyright (c) 2017 StagPoint Software | |
namespace StagPoint.Collections | |
{ | |
using System; | |
using System.Threading; | |
public class PackedIntArray | |
{ | |
#region Private instance variables |
This file contains 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
// Copyright (c) 2017 StagPoint Software | |
namespace StagPoint.Collections | |
{ | |
using System; | |
/// <summary> | |
/// Implements a basic Binary Min Heap that can be used for A* pathfinding. Items are removed from | |
/// the list in order from lowest to highest cost | |
/// </summary> |
This file contains 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
// Copyright (c) 2017 StagPoint Software | |
namespace StagPoint.Collections | |
{ | |
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
/// <summary> | |
/// Implements an Array-like interface for paged data that is object pool friendly. |
This file contains 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
public static bool IntersectsBox( Vector3 a, Vector3 b, Vector3 c, Vector3 boxCenter, Vector3 boxExtents ) | |
{ | |
// From the book "Real-Time Collision Detection" by Christer Ericson, page 169 | |
// See also the published Errata at http://realtimecollisiondetection.net/books/rtcd/errata/ | |
// Translate triangle as conceptually moving AABB to origin | |
var v0 = ( a - boxCenter ); | |
var v1 = ( b - boxCenter ); | |
var v2 = ( c - boxCenter ); |
This file contains 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
// Copyright (c) 2017 StagPoint Software | |
namespace StagPoint.Collections | |
{ | |
using System; | |
using System.Collections.Generic; | |
/// <summary> | |
/// Defines a set of extension methods to add commonly-used operations to every List instance. | |
/// </summary> |
This file contains 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
// Copyright (c) 2017 StagPoint Software | |
namespace StagPoint.ObjectPooling | |
{ | |
using System; | |
using System.Collections.Generic; | |
public class ObjectPool<T> where T : class | |
{ | |
#region Static variables |
This file contains 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
private bool planesIntersectAtSinglePoint( Plane p0, Plane p1, Plane p2, out Vector3 intersectionPoint ) | |
{ | |
const float EPSILON = 1e-4f; | |
var det = Vector3.Dot( Vector3.Cross( p0.normal, p1.normal ), p2.normal ); | |
if( det < EPSILON ) | |
{ | |
intersectionPoint = Vector3.zero; | |
return false; | |
} |
OlderNewer