Skip to content

Instantly share code, notes, and snippets.

View Lorenzo501's full-sized avatar
🐲
Making dreams come to life!

Lorenzo Pappalettera Lorenzo501

🐲
Making dreams come to life!
View GitHub Profile
@Ciantic
Ciantic / keyboardlistener.cs
Created July 11, 2010 17:33
C# Keyboard listener
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Windows.Input;
using System.Windows.Threading;
using System.Collections.Generic;
namespace Ownskit.Utils
{
@AngryAnt
AngryAnt / Hover.cs
Created July 15, 2011 09:48
Very simple hover script. Use in conjunction with WASD controller handling planar movement.
using UnityEngine;
public class Hover : MonoBehaviour
{
public float maxDistance, maxForce;
private Vector3 forceVector;
@AngryAnt
AngryAnt / GravityWell.cs
Created August 18, 2011 09:01
An example of how to easily do an inexpensive alternative gravity setup (untested).
// GravityObject.cs
using UnityEngine;
using System.Collections;
[RequireComponent (typeof (Rigidbody))]
public class GravityObject : MonoBehaviour
{
public float gravityModifier = 1.0f;
@AngryAnt
AngryAnt / ContainerGravity.cs
Created July 2, 2012 11:14
Example of simple component for keeping objects inside defined bounds by physically repelling them back when they exit.
using UnityEngine;
using System.Collections;
[RequireComponent (typeof (BoxCollider))]
public class ContainerGravity : MonoBehaviour
{
public float strength = 10.0f;
@AngryAnt
AngryAnt / CameraControl.cs
Created July 6, 2012 12:00
Example of a clamped camera look rotation.
target.RotateAround (target.position, target.right, addedRotation);
bool lookingUp = Vector3.Angle (target.forward, Vector3.up) < Vector3.Angle (target.forward, Vector3.up * -1.0f);
float angle = Vector3.Angle (target.forward, Vector3.Cross (target.right, Vector3.up));
if (angle > forwardAngleClamp)
{
target.RotateAround (target.position, target.right, lookingUp ? angle - forwardAngleClamp : forwardAngleClamp - angle);
}
@AngryAnt
AngryAnt / Utilities.cs
Created September 29, 2012 17:59
Example code for "Logging an entire GameObject" blog post on AngryAnt.com
using UnityEngine;
using System.Reflection;
public class Utilities
{
/* ... */
static void LogGameObject( GameObject gameObject, bool children )
{
Component[] components = gameObject.GetComponents( typeof( Component ) );
/* _______________________________________________________________________________________
_____ ______ __ _
|_ _| | ____| /_ || | _ _ _ SKAN (Suresh Kumar A N)
| | ___ ___ _ __ | |__ __ __ | || |_| | | | | | [email protected]
| | / __/ _ \| '_ \| __| \ \/ / | ||___| | | ' | |
_| || (_| (_) | | | | |____ > < | | | | | |__| | Created on : 13-May-2008
|_____\___\___/|_| |_|______/_/\_\ |_|(_) |_| \.___/ Last Modified : 10-Aug-2012
[ I C O N E X P L O R E R A N D E X T R A C T O R ] Version : 1.4u
_______________________________________________________________________________________
@AngryAnt
AngryAnt / MultiScene.cs
Created August 9, 2013 10:03
This utility lets you easily combine two scenes into one.
using UnityEngine;
using UnityEditor;
using System.IO;
public class MultiScene
{
[MenuItem ("File/Combine Scenes")]
static void Combine ()
{
@liortal53
liortal53 / StringLoggingExtensions.cs
Created June 16, 2014 18:32
Unity Debug.Log Helper
using System;
public enum Colors
{
aqua,
black,
blue,
brown,
cyan,
darkblue,
//#define DEBUG_THREADING
using UnityEngine;
using System.Collections;
using System.Threading;
using System.Reflection;
public delegate IEnumerator MonitorCoroutine<T> (CoroutineData<T> data);