Skip to content

Instantly share code, notes, and snippets.

@st4rdog
st4rdog / PrivacyPolicy.txt
Created November 30, 2023 22:14
PrivacyPolicy
Privacy Policy for One Brutal Dungeon
No Data Collection:
One Brutal Dungeon does not collect, store, or transmit any user data.
Contact:
If you have any questions or concerns regarding this Privacy Policy, please contact us at stardoggames@gmail.com.
@st4rdog
st4rdog / ListNonAlloc.cs
Last active April 8, 2024 17:48
Unity C# - Garbage-free List with Add/Remove functions
// Drop-in replacement for List<T>. Presized List so no garbage when adding/removing.
// Further reading:
// - Collections without the boxing - https://www.jacksondunstan.com/articles/5148
// - https://stackoverflow.com/questions/3737997/why-implement-ienumerablet-if-i-can-just-define-one-getenumerator
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@st4rdog
st4rdog / FPSCounter.cs
Last active November 27, 2023 17:35
Unity C# FPS Counter - Add to any GameObject, then assign any Text using inspector.
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class FPSCounter : MonoBehaviour
{
public enum DeltaTimeType
{
Smooth,
@st4rdog
st4rdog / FSM.cs
Last active January 17, 2024 22:51
C# Finite State Machine for Unity
using System;
using System.Collections.Generic;
using UnityEngine;
/* Example usage:
public FSM GameFSM = new();
private void Awake()
{
GameFSM.AddState("Init",
@st4rdog
st4rdog / msi-afterburner-undervolt-how-to.md
Last active March 24, 2024 04:54
MSI Afterburner Voltage Curve Editor Tutorial - Undervolt

Tutorial

  • Start at default curve.
  • Ctrl-click-drag any point in right-half to bend it until a point intersects with desired mhz/voltage.
  • Select point and adjust to perfection using shift-up-down.
  • Shift-click-drag empty space and select points (including selected point) on the right. Selected point should be left-most point.
  • Shift-Enter twice to flatten all points in selection area. They will flatten to match the selected point.
  • Adjust if required.

Controls

@st4rdog
st4rdog / SmoothMouseLook.cs
Last active October 14, 2022 21:59
Unity - Smoothed mouse look for an FPS
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SmoothMouseLook : MonoBehaviour
{
private List<float> _xBuffer = new List<float>();
private List<float> _yBuffer = new List<float>();
private int _bufferIndex;
@st4rdog
st4rdog / Messaging.cs
Created December 20, 2021 01:23
Event/Messaging system for C# - strongly typed
// Created by lordofduct - https://forum.unity.com/threads/recommended-event-system.856294/#post-5644981
//
// Usage example:
//
// public delegate void OnDiedEvent(GameObject go);
//
// Messaging<OnDiedEvent>.Trigger?.Invoke(gameObject);
//
// Messaging<OnDiedEvent>.Register(go => {
// Debug.Log($"{go.name} died.");
using UnityEngine;
using System.Collections.Generic;
using UnityEngine.UI;
namespace UIGradient
{
[AddComponentMenu("UI/Effects/Gradient")]
public class Gradient : BaseMeshEffect
{
[CustomEditor(typeof(Test))]
public class TestEditor : Editor
{
public override VisualElement CreateInspectorGUI()
{
var container = new VisualElement();
container.Add(new IMGUIContainer(OnInspectorGUI));
container.Add(new Label("Test"));
using UnityEngine;
using System.Collections;
public class ShakeTransformS : MonoBehaviour
{
[Header("Info")]
private Vector3 _startPos;
private float _timer;
private Vector3 _randomPos;