Skip to content

Instantly share code, notes, and snippets.

public class InputPlayer : IInput
{
public bool ShouldPlay{get{
return !GameSettings.PauseOnInaction ||
(
Input.GetKey(KeyCode.W) ||
Input.GetKey(KeyCode.A) ||
Input.GetKey(KeyCode.S) ||
Input.GetKey(KeyCode.D) ||
public interface IInput
{
void GetInput();
void EndInput();
void StartInput();
bool ShouldPlay {get;}
}
public enum InputTypes{
Player,
public class Player : MonoBehaviour, ITimed
{
[SerializeField]
float speed = 1;
[SerializeField]
bool isStartingPlayer = false;
public bool IsStartingPlayer {get{return isStartingPlayer;}}
[SerializeField]
CollDetector forwardDetector;
public class TimedState
{
SeriealizedState data;
ITimed timed;
public ITimed Target { get { return timed; } }
public SeriealizedState Data { get { return data; } }
public TimedState(ITimed timedObject, SeriealizedState serialized)
public class Timeline
{
int currentFrame = 0;
public int CurrentFrame
{
get { return currentFrame; }
set { currentFrame = value; }
}
public interface ITimed
{
TimedState Serialize();
void Hydrate(SeriealizedState state);
void Play(float time);
void ProcessAction(Action action);
}
public enum ActionEnum
{
PressForward,
ReleaseForward,
PressRight,
ReleaseRight,
PressBack,
ReleaseBack,
PressLeft,
@jesterswilde
jesterswilde / Action.cs
Created December 17, 2018 21:45
Time TraveL Action Class
public class Action
{
System.Object value;
public System.Object Value { get { return value; } }
ActionEnum type;
public ActionEnum Type { get { return type; } }
ITimed timed;
public ITimed Timed{get{return timed;}}
public Action(ITimed timedObj, ActionEnum actionEnum, System.Object valueToStore = null){
@jesterswilde
jesterswilde / functionInjection.js
Created August 31, 2018 14:35
function injection
const transformData = dataArray =>{
//transforms the data in some way
}
const dataToObj = dataArray =>{
//converts the data to a new form
}
//The final object will be an object that contains all dependencies in this file.
module.exports = (io)=>{
let roomID = 0;
let rooms = [];
let createRoom = function(id){
roomID++;
let room = {
isFull: function(){ return this.sockets.length >= this.capacity;},
capacity: 2,
sockets: [],
id : roomID,