Skip to content

Instantly share code, notes, and snippets.

View chuwilliamson's full-sized avatar
:octocat:

Matthew Williamson chuwilliamson

:octocat:
View GitHub Profile
using UnityEngine;
public class GameEventArgsListener : MonoBehaviour
{
public GameEventArgs Event;
public Object Sender;
public GameEventArgsResponse Response;
private void OnEnable()
{
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu]
public class GameEventArgs : ScriptableObject
{
public void Raise(params Object[] args)
{
@chuwilliamson
chuwilliamson / GameEventListener.cs
Created January 25, 2018 23:16
GameEventListener Monobehaviour from Unite 2017
//credit to Ryan Hipple Schell Games
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class GameEventListener : MonoBehaviour
{
public GameEvent Event;
public UnityEvent Response;
@chuwilliamson
chuwilliamson / GameEvent.cs
Last active February 3, 2024 15:27
GameEvent ScriptableObject from Unite 2017
/// Credit to Ryan Hipple from Schell Games
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
/// <summary>
/// Create a GameEvent in the Project View
/// This Event should be something meaningful. Ex: GameStart
/// The GameStart.asset will have its reference used in the project
@chuwilliamson
chuwilliamson / SimpleFSM.cs
Last active February 3, 2024 15:17
Simple Finite State Machine Generic
using System;
using System.Collections.Generic;
using System.Text;
namespace FiniteStateMachine
{
//Handles the function calls
public delegate void Handler();
//State class used for creating a state object
using UnityEngine;
using System;
//cloth simulation
[Serializable]
public class Particle
{
public Vector3 Position
{
get
//notes: 3/3/2014 boids keep flying to flock even though they should be ignoring them
//written by Matthew Williamson
//adapted from Conrad Parker's pseudocode of Craig W. Reynold's Boid's algorithm
//for Unity3D
//http://www.red3d.com/cwr
using UnityEngine;
using System.Collections;
//adaptation of Boids pseudocode into Unity taken from http://www.kfish.org/boids/pseudocode.html
public class BoidAlgorithm : MonoBehaviour
@chuwilliamson
chuwilliamson / Camera.cs
Last active February 3, 2024 15:16
Camera
void Motion(int x, int y)
{
if (mouseMoving)
{
//get the change in x since mouse down and increment
mouse_long += (x - oldX);
rLong = Rotation(mouse_long, 'y');
using System;
using UnityEngine;
class TranInputController : MonoBehaviour
{
Animator anim;
void Update()
{
if(Input.GetKeyDown(KeyCode.D))
{
[Serializable]
public enum ButtonCode
{
A,
B,
X,
Y,
DpadUp,
DpadDown,
DpadLeft,