Skip to content

Instantly share code, notes, and snippets.

View chuwilliamson's full-sized avatar
:octocat:

Matthew Williamson chuwilliamson

:octocat:
View GitHub Profile
@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
{
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)
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))
using System;
using System.Collections.Generic;
public interface IDamager
{
/// <summary>
/// OUTGOING DAMAGE
/// </summary>
/// <returns>return how much damage was SENT</returns>
@chuwilliamson
chuwilliamson / Interfaces.cs
Last active February 3, 2024 15:20
interface example
using System;
using System.Collections;
using System.Collections.Generic;
public interface IDamageable
{
void TakeDamage(int totalDamage);
}
class Wall : IDamageable
void BringTheNoise()
{
/*
To start with, we will be using glm’s perlin noise function to generate our noise instead of
implementing our own. The glm function simply takes in a vec2 and returns a float between -1 and 1.
Before just passing in our x and y we want to make some changes to them. First, we scale our point
down, in this case by 10. This is because Perlin noise always returns 0 on integer boundaries. The
Perlin noise function also returns a number between -1 and 1. For our height map we want a
number between 0 and 1 so we can later multiply it by our max height. To do this we multiply by 0.5
@chuwilliamson
chuwilliamson / FSM.cs
Created February 24, 2016 15:36
FSM in c#
//written by Ryan adaire aka the boss aka commit dis aka ya boy aka holla at
using System;
using System.Linq;
using System.Collections.Generic;
using UnityEngine;
public class FSM<T>
{
private List<TransitionObject> good_transitions;
#define GLM_FORCE_PURE
#include <vector>
#include "stdio.h"
#include <gl_core_4_4.h>
#include <GLFW/glfw3.h>
#include <glm/fwd.hpp>
#include <glm\glm.hpp>
#include <glm\ext.hpp>
#include <iostream>
#include <fstream>
@chuwilliamson
chuwilliamson / perlin.cpp
Last active February 3, 2024 15:23
perlinLyfe
#define GLM_FORCE_PURE
#include <vector>
#include "stdio.h"
#include <gl_core_4_4.h>
#include <GLFW/glfw3.h>
#include <glm/fwd.hpp>
#include <glm\glm.hpp>
#include <glm\ext.hpp>
#include <iostream>
#include <fstream>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Student
{