Skip to content

Instantly share code, notes, and snippets.

View LorenzGit's full-sized avatar

Lorenzo Nuvoletta LorenzGit

View GitHub Profile
using System;
using System.Collections.Generic;
using System.Text;
public class Program
{
class BinaryDataConverter{
private bool _isSerializing;
private List<byte> _bytesList;
protected byte[] _bytes;
@LorenzGit
LorenzGit / ObjToBytesAndBack.cs
Last active May 10, 2024 11:23
Convert an object to byte[] and back using BinaryFormatter
using System;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
public class Program
{
[Serializable]
class MyObj{
public string name = "hello world";
public int id = 1;
@LorenzGit
LorenzGit / Equations.cs
Last active June 25, 2016 04:32
Tweening Equations for C#
public static class Equations{
//t:currenttime, b:Start value, c:end value, d:duration
// -----------------------------------------------------------------------------------------------
public static float Linear(float t, float b, float c, float d){
return c * t / d + b;
}
// -----------------------------------------------------------------------------------------------
public static float BackEaseIn(float t, float b, float c, float d){
return c * ( t /= d ) * t * ( ( 1.70158f + 1f ) * t - 1.70158f ) + b;