Skip to content

Instantly share code, notes, and snippets.

View enricllagostera's full-sized avatar
💭
🌳 🎮 🛠 🔥 (he/him)

Enric Granzotto Llagostera enricllagostera

💭
🌳 🎮 🛠 🔥 (he/him)
View GitHub Profile
@munkbusiness
munkbusiness / Vibration.cs
Last active January 28, 2025 11:54
Vibration for Unity3d with Android native Call that supports both the new vibrationEffectClass and the old simple vibrate, with fallback to Handlheld.Vibrate().
using UnityEngine;
using System.Collections;
public class Vibration : MonoBehaviour {
public static AndroidJavaClass unityPlayer;
public static AndroidJavaObject vibrator;
public static AndroidJavaObject currentActivity;
public static AndroidJavaClass vibrationEffectClass;
public static int defaultAmplitude;
///
/// Placas objects dynamically around the player
/// by Nothke
///
/// unlicensed, aka do whatever you want with it
///
using UnityEngine;
using System.Collections.Generic;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
public static class PivotUtilities
{
[MenuItem("GameObject/Pivot/Create Pivot", false, 0)]
static void CreatePivotObject()
{

Phaser Cheatsheet

This is the content from the original Phaser cheatsheet, the site of which went down. I'm editing outdated information as I come across it.

Starting a new game

Reference: http://docs.phaser.io/Phaser.Game.html#Game

var game = new Phaser.Game(width, height, renderer, "parent");
//All parameters are optional but you usually want to set width and height
//Remember that the game object inherits many properties and methods!
@cjddmut
cjddmut / ColorHSV.cs
Last active August 24, 2022 21:02
A HSV Color struct for Unity3D. Allows conversion between UnityEngine.Color and UnityEngine.Color32.
/*
* Created by C.J. Kimberlin (http://cjkimberlin.com)
*
* The MIT License (MIT)
*
* Copyright (c) 2015
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
@bendangelo
bendangelo / EventManager.cs
Last active October 7, 2025 17:55
Unity3D C# Event Manager
/*
* Copyright 2017 Ben D'Angelo
*
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this
* software and associated documentation files (the "Software"), to deal in the Software
* without restriction, including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
* to whom the Software is furnished to do so, subject to the following conditions:
@aVolpe
aVolpe / Vibration.cs
Created October 16, 2014 02:45
Vibration for Unity3d with Android native Call, with fallback to Handlheld.Vibrate()
using UnityEngine;
using System.Collections;
public static class Vibration
{
#if UNITY_ANDROID && !UNITY_EDITOR
public static AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
public static AndroidJavaObject currentActivity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
public static AndroidJavaObject vibrator = currentActivity.Call<AndroidJavaObject>("getSystemService", "vibrator");
@lifelike
lifelike / cl5.py
Created August 14, 2013 19:14
Solution to the constraint logic problem on http://intelligenceengine.blogspot.com/2013/08/decision-modeling-and-optimization-in.html using the python-constraint library (http://labix.org/python-constraint) instead of a spreadsheet.
from constraint import *
cl = ['Warlock', 'Wizard', 'Mage', 'Runecaster', 'Sorcelator']
sp = ['Fireball', 'Iceball', 'SpellSteal', 'Drain Life', 'Smashing Hand']
pk = ['Mana Regeneration', 'Endurance', 'Haste', 'Fire Mastery', 'Ice Mastery']
clsv = [c + 'Spell' for c in cl]
clpv = [c + 'Perk' for c in cl]
p = Problem()