Skip to content

Instantly share code, notes, and snippets.

View chuwilliamson's full-sized avatar
:octocat:

Matthew Williamson chuwilliamson

:octocat:
View GitHub Profile
using System.IO;
using System.Xml.Serialization;
namespace MarvelRPG
{
public static class Utilities
{
public static void SerializeXML<T>(string s, T t, string path)
{
if (Directory.Exists(path))
def Run(self):
self.Reset()
open = self.OPEN
closed = self.CLOSED
start = self._start
goal = self._goal
open.append(start)
print(open)
while open:
open.sort(key = lambda x : x.f)
@chuwilliamson
chuwilliamson / astar.cs
Created May 10, 2016 22:54
Astar Unity
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
public class AStar : MonoBehaviour
{
public enum State
{
[Serializable]
public enum ButtonCode
{
A,
B,
X,
Y,
DpadUp,
DpadDown,
DpadLeft,
using System;
using UnityEngine;
class TranInputController : MonoBehaviour
{
Animator anim;
void Update()
{
if(Input.GetKeyDown(KeyCode.D))
{
@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');
//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
using UnityEngine;
using System;
//cloth simulation
[Serializable]
public class Particle
{
public Vector3 Position
{
get
@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
@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