Skip to content

Instantly share code, notes, and snippets.

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

Damon Fedorick Ddemon26

🏠
Working from home
  • Tent City Software
View GitHub Profile
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class NewMonoBehaviourScript : MonoBehaviour {
public List<Button> buttons = new List<Button>();
void Awake() {
foreach (var button in buttons) {
using UnityEngine;
public static class OSRSCombatCalculator {
// Calculates Melee Damage
public static int CalculateMeleeDamage(
int atkLvl, int atkBonus, int strLvl, int strBonus,
int defLvl, int defBonus,
float atkPrayer = 1f, float strPrayer = 1f,
float defPrayer = 1f, float damageMultiplier = 1f,
int atkStance = 0, int strStance = 0
@Ddemon26
Ddemon26 / CombatFormula.cs
Created November 9, 2024 07:31
OSRS combat formula
using System;
using UnityEngine;
namespace TCS.CombatFormula {
public static class CombatFormula {
public static int CalculateEffectiveStrength(int combatLevels, float prayerMultiplier = 1, float strengthBoost = 1) {
/*
*********Step 1: Calculate the Effective Strength Level*********
Formula: Effective Strength = floor((Base Strength + Strength Boost) * Prayer Bonus) + 8
@Ddemon26
Ddemon26 / FastRandom.cs
Last active October 29, 2024 03:14
Replacement for System.Random
using System;
namespace TCS.UnityUtils {
/// <summary>
/// A fast random number generator for .NET, from https://www.codeproject.com/Articles/9187/A-fast-equivalent-for-System-Random
/// Colin Green, January 2005
///
/// Key points:
/// 1) Based on a simple and fast xor-shift pseudo random number generator (RNG) specified in:
/// Marsaglia, George. (2003). Xorshift RNGs.
/// http://www.jstatsoft.org/v08/i14/xorshift.pdf
#nullable enable
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.ComponentModel;
namespace TCS.Infrastructure {
public abstract class ObservableObject : INotifyPropertyChanged, INotifyPropertyChanging {
public event PropertyChangingEventHandler? PropertyChanging;
using UnityEngine;
public static class Logger {
const string CLASS_NAME = "LogThisWithColor";
const string LOG_COLOR = "green";
static string ClassName => CLASS_NAME.SetPrefix();
static string SetPrefix(this string newString) => $"<color={LOG_COLOR}>[{newString}]</color>";
public static void Log(string message) => Debug.Log($"{ClassName} {message}");
public static void LogWarning(string message) => Debug.LogWarning($"{ClassName} {message}");
using System;
using System.Collections.Generic;
using System.Diagnostics;
using UnityEngine;
using Debug = UnityEngine.Debug;
using Object = UnityEngine.Object;
namespace TCS.TestSystems.Logging {
public static class GameLogger {
// Dictionary to hold Logger instances for each system, identified by Type
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Pool;
namespace TCS.TestSystems.AudioManager {
// AudioEvent class
public class AudioEvent {
public AudioClip Clip { get; }
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Pool;
public class GlobalPoolManager : MonoBehaviour {
// Singleton pattern to ensure only one instance of the manager
static GlobalPoolManager s_instance;
public static GlobalPoolManager Instance {
get {
if (s_instance) return s_instance;
using System;
using System.Collections.Generic;
using FPSPlayerController.DamonFPS.Player;
using UnityEngine;
namespace NewGameLogic.DamageSystem.Testing
{
[System.Serializable]
public class BulletPenetration
{
[SerializeField] private float damageMultiplier = 0.5f;