Skip to content

Instantly share code, notes, and snippets.

View aprius's full-sized avatar
⛱️
Nếu như lần đầu gặp mặt Ai sẽ vì ai mà quay đầu

Aprius aprius

⛱️
Nếu như lần đầu gặp mặt Ai sẽ vì ai mà quay đầu
View GitHub Profile
@aprius
aprius / CullingManager.cs
Created September 20, 2025 03:08 — forked from adammyhre/CullingManager.cs
CullingGroup API for Unity C#
using UnityEngine;
using System.Collections.Generic;
using UnityUtils; // https://github.com/adammyhre/Unity-Utils
public class CullingManager : Singleton<CullingManager> {
#region Fields
public Camera cullingCamera;
public float maxCullingDistance = 100f;
public LayerMask cullableLayers;
@aprius
aprius / DynamicNavMeshUpdater.cs
Created September 20, 2025 03:07 — forked from adammyhre/DynamicNavMeshUpdater.cs
Updating NavMesh at Runtime using Quantization
using System;
using Unity.AI.Navigation;
using UnityEngine;
using UnityEngine.AI;
[DefaultExecutionOrder(-115)] // Before input system
public class DynamicNavMeshUpdater : MonoBehaviour {
[Header("Agent Tracking")] [SerializeField, Tooltip("The agent whose position will be used to update the NavMesh")]
NavMeshAgent trackedAgent;
@aprius
aprius / Targeting.cs
Created September 7, 2025 14:06 — forked from adammyhre/Targeting.cs
Combinator Programming Pattern for Unity C#
using UnityEngine;
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using CanTarget = And<And<InRange, IsAlive>, LineOfSight>;
// ---------- Domain ----------
class Health : MonoBehaviour {
public int hp = 10;
#if UNITY_EDITOR
using System;
using UnityEngine;
using UnityEditor;
using System.Collections.Generic;
using UnityEditor.Build.Reporting;
using System.IO;
namespace JENKINS
{
public int timeSlicing = 2;
public void Update()
{
if (Time.frameCount % timeSlicing == 0)
{
// TODO
}
}
using System;
using System.IO;
using System.Linq;
#if UNITY_EDITOR
using UnityEditor;
#endif
using UnityEngine;
public class FooConfig : ScriptableObject
{
Shader "Custom/Freeze" {
Properties {
_MainTex ("Texture", 2D) = "white" {}
_ShadeColor ("Shade Color", Color) = (0.5,0.5,0.5)
_SpecularPower ("Specular Power", Range(0, 30)) = 1
_SpecularColor ("Specular Color", Color) = (0.5,0.5,0.5)
_FreezeRate ("Freeze Rate", Range(0.0, 1.0)) = 0
_FreezeRateMax ("Freeze Rate Max", Range(0.0, 1.0)) = 0.7
_FreezeBorder ("Freeze Border", Range(0.0, 1.0)) = 0.05
_FreezeBorderColor ("Freeze Border Color", Color) = (0.5,0.5,0.5)
Shader "Unlit/DemoShader"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100
using UnityEngine;
using UnityEngine.InputSystem;
public class ActionCallbackExample : MonoBehaviour
{
[SerializeField] private InputAction action;
private void OnEnable()
{
// Đăng ký callback
class Renderable : IRenderable
{
public void render()
{
}
}
class Moveable : IMoveable
{
public void move(float time)