Skip to content

Instantly share code, notes, and snippets.

View ashblue's full-sized avatar

Ash Blue ashblue

View GitHub Profile
@ashblue
ashblue / PlayerInputMonitor.cs
Created February 25, 2015 14:09
Unity player input monitoring wrapper
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using BehaviorDesigner.Runtime;
public class PlayerInputMonitor : MonoBehaviour {
// Behavior variables
Behavior behavior;
Dictionary<string, SharedBool> behaviorBools;
Dictionary<string, SharedFloat> behaviorFloats;
@ashblue
ashblue / JumpThrough.cs
Last active September 1, 2023 09:35
Unity 2D jump through platforms with fall support.
using UnityEngine;
using System.Collections;
public class Platform : MonoBehaviour {
SpriteRenderer playerGraphic;
Rigidbody2D playerBody;
BoxCollider2D playerBox;
CircleCollider2D playerCircle;
float padTop = -0.2f; // Padding applied to the top of feet platform checks (prevents player from barely standing on platform)
using System;
using System.Linq;
namespace BehaviorDesigner.Runtime.Tasks
{
[HelpURL ("http://www.opsive.com/assets/BehaviorDesigner/documentation.php?id=53"), TaskDescription ("Behavior Reference allows you to run another behavior tree within the current behavior tree."), TaskIcon ("BehaviorTreeReferenceIcon.png")]
public abstract class BehaviorReference : Action
{
[Tooltip ("Should the shared variables automatically be inherited from the parent tree?")]
public bool autoInheritVariables = true;
@ashblue
ashblue / DialogueDbManager.cs
Created December 19, 2014 03:20
Add multiple databases at load time to the master Dialogue System Database.
using UnityEngine;
using System.Collections.Generic;
namespace PixelCrushers.DialogueSystem.Adnc {
public class DialogueDbManager : MonoBehaviour {
[Tooltip("Allows you to add multiple databases to the current Dialogue System. @IMPORTANT Make sure to run the ID assigner to prevent overwriting.")]
[SerializeField] List<DialogueDatabase> db;
// Use this for initialization
void Awake () {
@ashblue
ashblue / maps.html
Created September 16, 2014 22:59
GMaps test Aquent Bootstrap
<iframe width="600" height="450" frameborder="0" style="border:0" src="https://www.google.com/maps/embed/v1/search?q=https://www.google.com/maps/embed/v1/search?q=360%203rd%20Street%2C%20San%20Francisco%2C%20CA%2C%20United%20States&key=AIzaSyA9R4ONwGZtWSfenQvFXaaLwkCyHMq5o7k"></iframe>
#
# Offer Drawer Module
#
# @author
#
(($, window, document) ->
class offerDrawerModule
_data: undefined
_defaultId: '#offer-drawer'
@ashblue
ashblue / drawer-fix.coffee
Last active March 26, 2021 16:59
From http://localhost/visa-signature/apply.jsp
DRAWER_CONTAINER = 'offer-drawer'
# Remove the drawer if the CSS class changes
_isMobileClass = false
$(window).resize(->
mobileOn = $HTML.hasClass('mobile')
# Change detected, clear the existing class
if mobileOn != _isMobileClass
_isMobileClass = mobileOn
@ashblue
ashblue / 0_reuse_code.js
Created August 27, 2014 17:29
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@ashblue
ashblue / unity-repeat-sprite.cs
Created July 23, 2014 15:55
Unity 2d repeating sprite
using UnityEngine;
using System.Collections;
// @NOTE the attached sprite's position should be "top left" or the children will not align properly
// Strech out the image as you need in the sprite render, the following script will auto-correct it
[RequireComponent (typeof (SpriteRenderer))]
// Generates a nice set of repeated sprites inside a streched sprite renderer
// @NOTE Vertical only, you can easily expand this to horizontal with a little tweaking
public class RepeatSpriteBoundary : MonoBehaviour {
@ashblue
ashblue / Parallax.cs
Last active November 21, 2022 05:49
Unity parallaxing script example
using UnityEngine;
using System.Collections;
// For usage apply the script directly to the element you wish to apply parallaxing
// Based on Brackeys 2D parallaxing script http://brackeys.com/
public class Parallax : MonoBehaviour {
Transform cam; // Camera reference (of its transform)
Vector3 previousCamPos;
public float distanceX = 0f; // Distance of the item (z-index based)