Skip to content

Instantly share code, notes, and snippets.

View kurtdekker's full-sized avatar

Kurt Dekker kurtdekker

View GitHub Profile
@kurtdekker
kurtdekker / SpinOnY.cs
Last active July 30, 2021 14:51
Spin an object on the Y axis in Unity3D.
using UnityEngine;
// @kurtdekker
// Place on a GameObject, set the desired rate of spin
public class SpinOnY : MonoBehaviour
{
[Header( "Degrees per second.")]
public float RateOfRotation = 200.0f;
@kurtdekker
kurtdekker / CheesyGrid.cs
Last active February 24, 2025 14:42
A super-cheesy 2D map / grid editor for Unity3D
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
// @kurtdekker - ultra Cheesy grid with in-built editor for Unity3D
//
// To use:
// make an empty game object
// drag this script on it
using UnityEngine;
using UnityEditor;
// @kurtdekker
// Make sure this is in an Editor folder!
public static class DuplicationHelpers
{
// duplicates the current object and puts it back right after the original.
[MenuItem( "Assets/Dupe Here FFS")]
@kurtdekker
kurtdekker / StopTheAction.cs
Created July 16, 2021 00:36
A way to easily pause the action while dialogs are up
using UnityEngine;
// @kurtdekker
//
// For stopping your game during instantiated / enabled dialogs.
//
// To use: put this script on things that you want to
// stop your game action when they appear, like dialogs.
//
// You only need one instance of this script per dialog.
@kurtdekker
kurtdekker / AttackSequencingDemo2.cs
Last active July 8, 2021 19:50
Same as AttackSequenceDemo but with coroutines
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// @kurtdekker
//
// from Unity forums: https://forum.unity.com/threads/logic-to-create-turns-of-attacks.1137946/
//
// Rewriting AttackSequencingDemo as coroutines, as per GroZZler's suggestion.
//
@kurtdekker
kurtdekker / HyperSimpleFlightControls.cs
Created July 8, 2021 17:05
Hyper-cheesy-simple non-aerodynamic flight controls.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// @kurtdekker
//
// Hyper-cheesy non-aerodynamic flight controls
//
// To use:
// - slap this on your camera
@kurtdekker
kurtdekker / AttackSequencingDemo.cs
Created July 8, 2021 16:41
Simple attack sequencing, timers, no coroutines, just state machine with timers
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// @kurtdekker
//
// from Unity forums: https://forum.unity.com/threads/logic-to-create-turns-of-attacks.1137946/
//
// goal: a random attack starts in 2-5 seconds, you have 1 second to defend against it
//
@kurtdekker
kurtdekker / DelayedActivation.cs
Created July 5, 2021 15:38
Delayed activation of GameObjects in Unity3D
using System.Collections;
using UnityEngine;
// @kurtdekker - delayed-activates things in your scene:
// To use:
// 1. put this script on fresh blank GameObject
// - NOT the same one that you are delayed-activating
// - NOT a child of the one(s) you are delayed-activating!
// - MAY be above other child GameObjects you activate (eg at top of hierarchy)
// 2. set the amount of delay in TimeToDelay field
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// @kurtdekker random spawn utilities from my Jetpack Kurt game (And other games)
public static class SpawnUtilities
{
public static bool ProgressiveLiftAndCastDown( ref Vector3 position, out Vector3 normal)
{
Vector3 pos = position;
@kurtdekker
kurtdekker / MoteSystem.cs
Created July 1, 2021 16:44
Mote System (particle system) for Jetpack Kurt
using UnityEngine;
using System.Collections;
public class MoteSystem : MonoBehaviour
{
public Transform target;
System.Func<Vector3> GetPlayerVelocity;
const float limitDistance = 15.0f;
const int BASE_NUM_MOTES = 300;