Skip to content

Instantly share code, notes, and snippets.

Avatar
🤘

Damien Mayance valryon

🤘
View GitHub Profile
@valryon
valryon / CameraShaker.cs
Created Nov 20, 2017
Simple camera shaker for Unity3D
View CameraShaker.cs
using UnityEngine;
/// <summary>
/// Shake shake shake the screen!
/// </summary>
public class CameraShaker : MonoBehaviour
{
#region Members
private static CameraShaker instance;
private Transform camTransform;
@valryon
valryon / Bezier.cs
Created Sep 23, 2015
Bezier curves in Unity
View Bezier.cs
/// <summary>
/// Easy and simple Bezier curves for Unity
/// </summary>
/// <remarks>http://devmag.org.za/2011/04/05/bzier-curves-a-tutorial/ </remarks>
public static class Bezier
{
/// <summary>
///
/// </summary>
/// <param name="t">Time, between 0 and 1</param>
@valryon
valryon / langoliers.rb
Created Feb 29, 2020 — forked from robinsloan/langoliers.rb
Tweet delete script
View langoliers.rb
require "rubygems"
require "twitter"
require "json"
# things you must configure
TWITTER_USER = "your_username"
MAX_AGE_IN_DAYS = 1 # anything older than this is deleted
# get these from dev.twitter.com
CONSUMER_KEY = "your_consumer_key"
@valryon
valryon / WaterLine.cs
Last active Apr 25, 2020
2d Water Line in Unity. With realtime mesh construction and deformation. Just a start, no physics. Thanks to http://forum.unity3d.com/threads/141925-2d-Water and http://games.deozaan.com/unity/MeshTutorial.pdf
View WaterLine.cs
// Author: Damien Mayance (http://dmayance.com)
// 2013 - Pixelnest Studio (http://pixelnest.io)
//
// This script simulates a simple 2d water line behavior, like you see in many 2d games.
// See http://dmayance.com/water-line-2d-unity/ for further explanations.
//
// Usage:
// - Attach it to an object
// - Then fill the "Material" parameter
// - Start the game (here it is only visible at runtime)
@valryon
valryon / DecalPainter.cs
Last active May 4, 2020
An improved version of my unity script that can splash a decal prefab (or anything else) in random direction from a point using raycasting.
View DecalPainter.cs
// Author: Damien Mayance (http://dmayance.com)
// 2013 - Pixelnest Studio (http://pixelnest.io)
//
// This script paints decals on surfaces it hits from a point.
// See http://dmayance.com/2013-10-09-unity-paint-part-2/ for further explanations.
//
// Usage:
// - Attach it to an unique object that won't be deleted of your choice. There should be only one instance of this script.
// - Then fill the "PaintDecalPrefabs" list with your decals prefabs.
// - Finally, just call DecalPainter.Instance.Paint from another script to paint!
@valryon
valryon / LaserScript.cs
Created Sep 23, 2014
A simple expendable Laser script for Unity
View LaserScript.cs
using UnityEngine;
using System.Collections;
public class LaserScript : MonoBehaviour
{
[Header("Laser pieces")]
public GameObject laserStart;
public GameObject laserMiddle;
public GameObject laserEnd;
@valryon
valryon / ScrollingScript.cs
Last active Oct 19, 2020
Multi directionnal infinite scrolling script.This is related to the tutorial http://pixelnest.io/tutorials/2d-game-unity/parallax-scrolling/
View ScrollingScript.cs
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
/// <summary>
/// Parallax scrolling script that should be assigned to a layer
///
/// This is related to the tutorial http://pixelnest.io/tutorials/2d-game-unity/parallax-scrolling/
///
@valryon
valryon / Extruder.cs
Created Nov 18, 2016
Extrude a 2D sprite to a mesh from a Polygon Collider in Unity3D
View Extruder.cs
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
/// <summary>
///
/// </summary>
/// <remarks>Source: https://forum.unity3d.com/threads/trying-extrude-a-2d-polygon-to-create-a-mesh.102629/ </remarks>
[RequireComponent(typeof(MeshFilter), typeof(MeshRenderer), typeof(PolygonCollider2D))]
public class ExtrudeSprite : MonoBehaviour
@valryon
valryon / Timer.cs
Last active Jan 17, 2021
Unity simple Timer with co-routine
View Timer.cs
// 2014 - Pixelnest Studio
using System;
using System.Collections;
using UnityEngine;
/// <summary>
/// Ready to use timers for coroutines
/// </summary>
/// <summary>
/// Ready to use timers for coroutines