Skip to content

Instantly share code, notes, and snippets.

View aefreedman's full-sized avatar
🏠
Working from home

Aaron aefreedman

🏠
Working from home
  • Secret Crush Corp.
  • Brooklyn, NY
View GitHub Profile
@aefreedman
aefreedman / VisualDebugLog.cs
Created August 28, 2023 16:03
GUILayout debug log for Unity
using System.Collections;
using UnityEngine;
/// <summary>
/// From https://stackoverflow.com/questions/67704820/how-do-i-print-unitys-debug-log-to-the-screen-gui
/// </summary>
public class VisualDebugLog : MonoBehaviour
{
private readonly Queue _myLogQueue = new();
/// <summary>
/// Returns the signed angle between two transforms, from the perspective of the From transform, ignoring the Y axis
/// </summary>
/// <param name="fromTransform"></param>
/// <param name="toTransform"></param>
/// <returns></returns>
public static float InverseSignedAngleBetweenXZ(this Transform fromTransform, Transform toTransform)
{
// Remove the Y coordinate from the reference position and the target position
var toPosition = new Vector3(toTransform.position.x, 0, toTransform.position.z);
//Calico post processing with stencil mask
// https://twitter.com/CalicoGame/status/1121221295536951296
using System;
using UnityEngine;
using UnityEngine.Rendering;
[ExecuteInEditMode, ImageEffectAllowedInSceneView]
public class ScreenMaterialCommandBuffer : MonoBehaviour
{
var PLAYER_INITIAL_VELOCITY_BOOST=2; //player gets a little burst of velocity when a key is pressed
var PLAYER_ACCEL = 200; //the player's movement acceleration
var PLAYER_MAXSPEED = 400; //the player's top speed is capped
var PLAYER_DRAG = 0.96; //how quickly you slow down after letting go of the cursor keys
var PLAYER_HITBOX_WIDTH=32; //in shooters we want the player's collision box to have its own size
var PLAYER_HITBOX_HEIGHT=32;
var PLAYER_MAXHEALTH =3; //number of hits until player killed
var PLAYER_REVIVE_DELAY=2.25; //delay before player revived
var PLAYER_ANIMATE_FRAME_RATE = 30; //speed to animate plane moving left/right
var PLAYER_SAFE_ZONE = 280; //area at bottom of screen that the enemies won't move into
@aefreedman
aefreedman / GameManager.cs
Last active September 29, 2019 21:06
A partially complete game manager for a narrative game
//CAT ROOMMATE v2 by m@ boch - NYU GAMECENTER - Oct 2016
// Updated for Unity 2019 by AEFreedman
// This version doesn't work, you'll need to fix it!
using System.Collections;
using System.Collections.Generic; //We're using generic collections, specifically List<string>, so we have to add this directive
using TMPro;
using UnityEditor;
using UnityEngine;
@aefreedman
aefreedman / ev0190.txt
Created March 28, 2017 00:20
medianoche
|||||||||| CRI Medianoche [NR] Ver.1.70.00 ||||||||||
Copyright (c) 2000-2012 CRI Middleware Co.,Ltd (2013-03-08)
[ Phase <Encode> : "ev0190.avi" ]
>> File Information
| File Size : 2602594 [bytes]
| File Type : AVI
| Total Frames : 79
| Stream ID : 0x00000000
@aefreedman
aefreedman / CSVReader.cs
Last active November 1, 2016 20:12
CSV Level loading example
// CSVReader.cs
// Last edited 12:32 PM 04/17/2015 by Aaron Freedman
using System.Linq;
using System.Text.RegularExpressions;
using UnityEngine;
/*
CSVReader by Dock. (24/8/11)
@aefreedman
aefreedman / .gitignore
Created November 9, 2012 00:36 — forked from mduheaume/.gitignore
Git ignore file for unity projects
Temp/
Library/
obj/
*.svd
!Library/*.asset
!Library/AssetImportState
!Library/AssetVersioning.db
!Library/BuildPlayer.prefs
!Library/ScriptMapper