Instantly share code, notes, and snippets.

View TileBitmaskCalculation.cs
ushort bitMaskValue = left * 8 + down * 4 + right * 2 + up * 1;
View CryptoTools.cs
/// <summary>
/// Encrypt data with AesCryptoServiceProvider, which should use FIPS 140-2 compliant library
/// </summary>
/// <param name="key"></param>
/// <param name="IV"></param>
/// <param name="data"></param>
/// <returns></returns>
public byte[] EncryptDataAESCryptoServiceProvider(byte[] key, byte[] IV, object data)
{
View BoidRigidbody2D.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[RequireComponent(typeof(Rigidbody2D), typeof(Collider2D))]
public class BoidRigidbody2D : MonoBehaviour
{
//our boid's rigidbody
public Rigidbody2D thisRigidbody2D;
View Boids.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Boids : MonoBehaviour {
//predefined array to keep unity GC low
private Collider2D[] surroundingCollidersNonAlloc = new Collider2D[10];
private int surroundingColliderNonAllocLength = 0;
//filtered array of surrounding units, predefinied to keep GC low.
View SimpleVRPlayerController.cs
/*************************************************************************
* SimpleVRPlayerController created by Chris @ ChrisHammond.ca
* __________________
*
* Usage: Please feel free to use this code for your own personal or commercial
* projects if it helps or is any benefit to you.
*
*
*/
using System.Collections;
View Simple2DTargetScanner.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Simple2DTargetScanner : MonoBehaviour
{
public float scanFrequency; //in seconds
public float scanRadius = 5; //in world units
private float scanFrequencyCounter = 0; //counter for time between scans