Skip to content

Instantly share code, notes, and snippets.

View eka's full-sized avatar
🏠
Working from home

Esteban Feldman eka

🏠
Working from home
View GitHub Profile
@eka
eka / uuid_generator.gd
Last active March 21, 2024 02:40
Poormans UUID Generator for Godot 4.x
extends Node
func generate_uuid_v4() -> String:
var uuid = PackedByteArray()
for i in range(16):
uuid.append(randi() % 256)
# Set the version to 4 (randomly generated UUID)
uuid[6] = (uuid[6] & 0x0F) | 0x40
# Set the variant to DCE 1.1, ITU-T X.667
uuid[8] = (uuid[8] & 0x3F) | 0x80
@eka
eka / ExplosiveBarrel.cpp
Created January 30, 2024 14:47
Using Interfaces to implement MagicProjectile hitting something
// Fill out your copyright notice in the Description page of Project Settings.
#include "ExplosiveBarrel.h"
#include "PhysicsEngine/RadialForceComponent.h"
// Sets default values
AExplosiveBarrel::AExplosiveBarrel()
{
using Godot;
using System;
public abstract class State : Node
{
[Signal]
public delegate void Finished(string nextState);
[Signal]
public delegate void Stack(string nextState);
@eka
eka / bofh_excuses.txt
Created October 30, 2019 10:48
BOFH excuse list
clock speed
solar flares
electromagnetic radiation from satellite debris
static from nylon underwear
static from plastic slide rules
global warming
poor power conditioning
static buildup
doppler effect
hardware stress fractures
@eka
eka / AccelerationControl.cs
Created December 27, 2018 08:39
Acceleration example for Unity
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AccelerationControl : MonoBehaviour
{
public float Speed = 50f;
// Use this for initialization
void Start () {
@eka
eka / GameManager.cs
Created July 27, 2018 12:29
InfiniteRunner Managers Can't be extended
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace YakDogGames
{
public class GameManager : MoreMountains.InfiniteRunnerEngine.GameManager
{
public override void LoseLives(int lives)
{
using System;
using System.Collections;
using System.Collections.Generic;
using DoozyUI;
using TMPro;
using UnityEngine;
using UnityEngine.Purchasing;
using UnityEngine.SceneManagement;
namespace YakDogGames
using System;
using System.Collections;
using System.Collections.Generic;
using Sirenix.OdinInspector;
using Sirenix.OdinInspector.Editor;
using Sirenix.Utilities;
using Sirenix.Utilities.Editor;
using UnityEditor;
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
using DoozyUI;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
public class RateUsManager : MonoBehaviour
{
using UnityEngine;
/// <summary>
/// Be aware this will not prevent a non singleton constructor
/// such as `T myT = new T();`
/// To prevent that, add `protected T () {}` to your singleton class.
///
/// As a note, this is made as MonoBehaviour because we need Coroutines.
/// </summary>
public class Singleton<T> : MonoBehaviour where T : MonoBehaviour