Skip to content

Instantly share code, notes, and snippets.

Ferran Bertomeu Fonserbc

Block or report user

Report or block Fonserbc

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Fonserbc
Fonserbc / SwipeInput.cs
Last active Aug 28, 2019
A simple swipe detector for touchscreens for Unity3D. Four cardinal directions.
View SwipeInput.cs
using UnityEngine;
/*
* Swipe Input script for Unity by @fonserbc, free to use wherever
*
* Attack to a gameObject, check the static booleans to check if a swipe has been detected this frame
* Eg: if (SwipeInput.swipedRight) ...
*
*
*/
@Fonserbc
Fonserbc / PseudoRandomBoolean.cs
Last active Aug 29, 2015
A boolean, written for use in Unity3D, that evaluates to true pseudo-randomly. Given a *baseProbability* from 0 to 1, it follows a Pseudo-Random Distribution inspired by http://wiki.teamliquid.net/dota2/Pseudo_Random_Distribution Every time it evaluates false, it increases the probability to evaluate true.
View PseudoRandomBoolean.cs
using UnityEngine;
using System;
/**
* Source at https://gist.github.com/Fonserbc/d061905a48555e583edc
* Made by @fonserbc
* Inspired by Valve's PRNG in use in Dota 2
*/
public class PseudoRandomBoolean {
@Fonserbc
Fonserbc / EdgeCollider2DEditor.cs
Last active Oct 31, 2018
A small editor script for Unity3D to edit EdgeCollider2D points on editor
View EdgeCollider2DEditor.cs
using UnityEditor;
using UnityEngine;
using System;
public class EdgeCollider2DEditor : EditorWindow {
[MenuItem("Window/EdgeCollider2D Snap")]
public static void ShowWindow() {
EditorWindow.GetWindow (typeof(EdgeCollider2DEditor));
}
@Fonserbc
Fonserbc / Easing.cs
Last active Sep 18, 2019
Compact and simple easing functions for Unity
View Easing.cs
using UnityEngine;
/*
* Functions taken from Tween.js - Licensed under the MIT license
* at https://github.com/sole/tween.js
*/
public class Easing
{
public static float Linear (float k) {
You can’t perform that action at this time.