Skip to content

Instantly share code, notes, and snippets.

View Domiii's full-sized avatar

Domi Domiii

View GitHub Profile
@Domiii
Domiii / Elevator.cs
Last active October 7, 2021 17:22
[Unity v5.3] Simple elevator
/**
* A simple elevator script. Can be attached to any object to make it move in the given direction.
* Requires a button that calls CallElevator().
*/
using UnityEngine;
using System.Collections;
public class Elevator : MonoBehaviour {
/// <summary>
@Domiii
Domiii / WallSpawner.cs
Last active July 9, 2016 14:30
[Unity v5.3] Create brick wall
/**
* Spawns a wall along the X and Y axes of the WallSpawner, using cubes of given size and materials
*/
using UnityEngine;
using System.Collections;
public class WallSpawner : MonoBehaviour {
public int Nx = 10;
public int Ny = 10;
@Domiii
Domiii / SceneNavigator2D.cs
Last active September 29, 2019 02:41
[Unity v5.3] Unity component that allows panning and zooming orthographic camera with standard input, also clamps camera to given container (bounds of a given Sprite)
/**
* 2D camera panning and scrolling. Always clamped to given container.
*/
using UnityEngine;
using System.Collections;
public class SceneNavigator2D : MonoBehaviour {
public Camera Camera;
@Domiii
Domiii / ImprovedPolygonCollider2D.cs
Created July 10, 2016 10:34
[Unity v5.3] Comes with an Editor that allows easily working around the Polygon2DCollider bug. WARNING: Make sure to place the Editor script in an Editor folder!
/**
* Comes with an Editor that allows easily working around the Polygon2DCollider bug.
*/
using UnityEngine;
using System.Collections;
[RequireComponent(typeof(PolygonCollider2D))]
public class ImprovedPolygonCollider2D : MonoBehaviour {
}
@Domiii
Domiii / HaloPickUp2D.cs
Last active February 23, 2017 06:28
[Unity v5.4] Let's Player pick up an object and then lets it hover over their head
using UnityEngine;
using System.Collections;
/// <summary>
/// Halo (光環)
/// </summary>
public class HaloPickUp2D : MonoBehaviour {
public Player player;
public Vector2 relativePosition = new Vector2(0, 1);
public Vector2 bobbingRadius = new Vector2(0.8f, 0.2f);
@Domiii
Domiii / ROE_Assist.js
Last active October 19, 2017 15:41
Realm of Empiires - Assist
/**
########################################################################
Intro
########################################################################
Title: ROE Assist
Description: Loose collection of scripts that might make playing ROE a little bit more interesting.
Video of a very early version of the auto raid loop: http://i.imgur.com/tjjMOtg.gifv (30s video of 25 min. play-time)
########################################################################
/**
* Move a cube by rolling in four directions.
*/
using UnityEngine;
using System.Collections;
public class RollingCube : MonoBehaviour {
public float speed = 2;
using UnityEngine;
using System.Collections;
public class Explosion2D : MonoBehaviour {
public float power = 10;
public float radius = 10;
void OnMouseDown() {
Explode (transform.position, radius, power);
}
/**
* jsBezier-0.8
*
* Copyright (c) 2010 - 2016 jsPlumb (hello@jsplumbtoolkit.com)
*
* licensed under the MIT license.
*
* a set of Bezier curve functions that deal with Beziers, used by jsPlumb, and perhaps useful for other people. These functions work with Bezier
* curves of arbitrary degree.
*
[System.Serializable]
public struct IntVector2 {
public int x, y;
public IntVector2 (int x, int y) {
this.x = x;
this.y = y;
}