Skip to content

Instantly share code, notes, and snippets.

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

Damon Fedorick Ddemon26

🏠
Working from home
View GitHub Profile
using Sirenix.OdinInspector;
using UnityEngine;
namespace TC._Project.Scripts.Simple {
/// <summary>
/// This class allows a GameObject with a CharacterController to push Rigidbodies.
/// </summary>
public class SimpleRigidBodyPush : MonoBehaviour {
[Tooltip("Layers that can be pushed.")]
[SerializeField] LayerMask m_pushLayers;
using System;
using System.Collections.Generic;
namespace TC._Project.Scripts
{
public class ExpTable
{
Dictionary<int, int> m_expTable = new Dictionary<int, int>();
/// <summary>
/// Generates the experience points (EXP) table up to the specified maximum level.
using UnityEngine;
namespace TC._Project.Scripts.Simple
{
public class SimpleRotateObject : MonoBehaviour {
enum RotationAxis {
X,
Y,
Z
}
using DG.Tweening;
using UnityEngine;
namespace TC._Project.Scripts.Utilities
{
public class MenuAnimator {
readonly RectTransform m_menu;
readonly float m_menuMoveSpeed;
readonly Vector3 m_originalPosition;
readonly Direction m_direction;
using UnityEngine;
using DG.Tweening;
namespace TC._Project.Scripts.Utilities
{
/// <summary>
/// Class to handle the movement of a RectTransform based on mouse position.
/// </summary>
public class RectTransformMover : MonoBehaviour
{
@Ddemon26
Ddemon26 / DragWindow.cs
Created August 30, 2024 07:38
Simple Drag Window Script
using UnityEngine;
using UnityEngine.EventSystems;
namespace TC._Project.TestSystems.Debugging {
/// <summary>
/// A class that allows a UI window to be dragged within the bounds of its parent canvas.
/// </summary>
public class DragWindow : MonoBehaviour, IDragHandler, IPointerDownHandler {
[Tooltip("The RectTransform of the window to be dragged.")]
[SerializeField] RectTransform m_dragRectTransform;
using UnityEngine;
namespace TC._Project.TestSystems.Debugging {
/// <summary>
/// A class to capture screenshots in Unity.
/// </summary>
public class TakeScreenShot : MonoBehaviour {
[Tooltip("The file path where screenshots will be saved.")]
[SerializeField] string m_filePath = Application.dataPath + "/Screenshots";
[Tooltip("Whether to use a key press to trigger the screenshot.")]
public bool m_useKey = true;
@Ddemon26
Ddemon26 / ToolKitStrings.cs
Created September 8, 2024 22:17
Strings for UI Tool Kit
using UnityEngine;
namespace TC._UIToolkit {
public static class ToolKitStrings {
// USS Classes (commonly used)
public static readonly string ScrollView = "__unity-scroll-view";
public static readonly string ListView = "__unity-list-view";
public static readonly string Button = "__unity-button";
public static readonly string Toggle = "__unity-toggle";
public static readonly string Label = "__unity-label";
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;
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;