Skip to content

Instantly share code, notes, and snippets.

@codorizzi
codorizzi / SpriteMerger.cs
Created June 21, 2023 10:04
Unity Sprite Merging - Takes children Sprite Renderers, Merges them into a single parent
using System.Collections;
using System.Collections.Generic;
using Sirenix.OdinInspector;
using UnityEngine;
[RequireComponent(typeof(SpriteRenderer))]
public class SpriteMerger : MonoBehaviour
{
private const int PixelsPerUnit = 256;
using Newtonsoft.Json;
using Utilities.GameSettings;
namespace Framework.Map {
public class BuildingTypes : GameSetting<BuildingTypes, BuildingTypes.DataModel> {
#region Sub Classes / Enums
// requires static enum to be defined
public enum IdTypes {
@codorizzi
codorizzi / RealTime.cs
Created March 26, 2022 15:01
FireBase - RealTime DB Rest API
using Newtonsoft.Json;
using Proyecto26;
using RSG;
// Dependencies
// REST Client - https://assetstore.unity.com/packages/tools/network/rest-client-for-unity-102501
// JSON .Net - https://assetstore.unity.com/packages/tools/input-management/json-net-for-unity-11347
namespace Utility.FireBase {
@codorizzi
codorizzi / words.csv
Created December 4, 2021 10:21
English Dictionary + Definitions
We can't make this file beautiful and searchable because it's too large.
definition,language,word
an act of cheating someone; a swindle.,en,jip
workout of the day (with reference to the CrossFit fitness programme).,en,wod
"used in names of plants and herbs, especially those used formerly as food or medicinally, e.g. butterwort, lungwort, woundwort.",en,wort
archaic or dialect term for hip2.,en,hep
"(in Thailand, Cambodia, and Laos) a Buddhist monastery or temple.",en,wat
"completely destroy (a building, town, or other settlement).",en,rase
an allowance made for the weight of the packaging in order to determine the net weight of goods.,en,tare
a cartoon film.,en,toon
a modern English translation of the Bible published in 1973–8.,en,niv
@codorizzi
codorizzi / Delaunator.cs
Created October 29, 2021 13:31
Unity Mapping Algorithms
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace GameAssets.Scripts.Delaunay
{
public interface IVoronoiCell
{
@codorizzi
codorizzi / RadialTimer
Last active August 11, 2022 09:44
Unity - Radial Timer Bar
/*
* Author - https://twitter.com/JSqearle
* License - CC BY-SA
* Asset Dependencies:
* - https://assetstore.unity.com/packages/tools/sprite-management/shapes2d-procedural-sprites-and-ui-62586 (Free)
* - https://assetstore.unity.com/packages/tools/utilities/odin-inspector-and-serializer-89041 (optional - can be removed)
* - https://assetstore.unity.com/packages/tools/animation/dotween-hotween-v2-27676 (Free)
*/
using DG.Tweening;
@codorizzi
codorizzi / HorizontalOrVerticalLayoutGroupEditor.cs
Last active April 30, 2024 20:57
Unity - Smooth Layout Group (using DoTween)
using UnityEditor;
using UnityEngine;
namespace Utility.SLayout {
[CustomEditor(typeof(SHorizontalOrVerticalLayoutGroup), true)]
[CanEditMultipleObjects]
/// <summary>
/// Custom Editor for the HorizontalOrVerticalLayoutGroupEditor Component.
/// Extend this class to write a custom editor for a component derived from HorizontalOrVerticalLayoutGroupEditor.
/// </summary>
@codorizzi
codorizzi / DebugExt.cs
Created June 4, 2021 06:15
Rough draw spherecast debug code using lines
public static void DrawSphereCast(Vector3 origin, float radius, Color color, float duration = 0.1f) {
for(int x = -1; x < 2; x++)
for(int y = -1; y < 2; y++)
for (int z = -1; z < 2; z++) {
Vector3 end = origin + new Vector3(x, y, z) * radius;
Debug.DrawLine(origin, end, color, duration);
}
}
@codorizzi
codorizzi / ParticleSystemLine.cs
Last active June 1, 2021 07:44
Creates a line between two points using a particle system
using Sirenix.OdinInspector;
using UnityEngine;
namespace GameAssets.Scripts.Utility {
public class ParticleSystemLine : MonoBehaviour {
#region Target
[FoldoutGroup("Target")]
[OnValueChanged("UpdateTarget")] public bool useTransform = true;
@codorizzi
codorizzi / ParticleSystemCircle.cs
Created June 1, 2021 05:56
Controller for Particle System Circle
using Sirenix.OdinInspector;
using UnityEngine;
public class ParticleSystemCircle : MonoBehaviour {
private ParticleSystem _particleSystem;
private ParticleSystem.MainModule _main;
private ParticleSystem.ShapeModule _shape;
private ParticleSystem.EmissionModule _emission;
private ParticleSystem.VelocityOverLifetimeModule _velocity;