Skip to content

Instantly share code, notes, and snippets.

View MrChrisHammond's full-sized avatar
🎯
Focusing

Chris MrChrisHammond

🎯
Focusing
View GitHub Profile
@MrChrisHammond
MrChrisHammond / TileBitmaskCalculation.cs
Created September 5, 2018 15:39
Simple bitmask calculation example for tiles
ushort bitMaskValue = left * 8 + down * 4 + right * 2 + up * 1;
@MrChrisHammond
MrChrisHammond / CryptoTools.cs
Last active September 4, 2018 02:34
CryptoTools
/// <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)
{
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;
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.
@MrChrisHammond
MrChrisHammond / SimpleVRPlayerController.cs
Created August 29, 2017 01:31
A simple Android VR Player Controller for Handheld Joystick Input.
/*************************************************************************
* 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;
@MrChrisHammond
MrChrisHammond / Simple2DTargetScanner.cs
Last active July 20, 2017 22:25
Simple 2D Target Scanner for Unity
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