Skip to content

Instantly share code, notes, and snippets.

View zhaoguohao's full-sized avatar
🚩
🐬

zhaoguohao

🚩
🐬
  • SkyStar Studio
  • YeShan Planet Earth
View GitHub Profile
@zhaoguohao
zhaoguohao / Flicker.cs
Created March 16, 2026 12:54 — forked from LotteMakesStuff/Flicker.cs
Quake/Halflife style light flicker
using UnityEngine;
public class Flicker : MonoBehaviour
{
public string LightStyle = "mmamammmmammamamaaamammma";
private Light light;
public float loopTime = 2f;
[SerializeField]
private int currentIndex = 0;
@zhaoguohao
zhaoguohao / InspectorButtonsTest.cs
Created March 16, 2026 12:52 — forked from LotteMakesStuff/InspectorButtonsTest.cs
Code running pack! two property drawing scripts that make it super easy to trigger code via buttons in the inspector, and get feedback! [TestButton] draws you little buttons that call a method on your MonoBehaviour, and [ProgressBar] give you a great way to show feedback from long running methods. These are *super* helpful for things like proced…
using UnityEngine;
using System.Collections;
public class InspectorButtonsTest : MonoBehaviour
{
[TestButton("Generate world", "DoProcGen", isActiveInEditor = false)]
[TestButton("Clear world", "ClearWorld", 2, isActiveInEditor = false)]
[ProgressBar(hideWhenZero = true, label = "procGenFeedback")]
public float procgenProgress = -1;
@zhaoguohao
zhaoguohao / snake.html
Last active March 12, 2026 13:09
snake generate by openClaw
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>贪吃蛇大冒险 🐍</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%); font-family: 'Segoe UI', sans-serif; color: #fff; padding: 10px; overflow: hidden; }
h1 { font-size: 1.5rem; margin-bottom: 10px; text-shadow: 0 0 15px rgba(0, 255, 136, 0.5); }
@zhaoguohao
zhaoguohao / pathfinding.c
Created August 20, 2025 08:44 — forked from starwing/pathfinding.c
A* Path finding in Lua
/*
* AStarfinding
*
* local path_find = require "pathfinding"
*
* local function neighbors(add, x, y, dist)
* add(x+1, y, hint, 1)
* end
*
* local r = path_find(sx, sy, tx, ty, neighbors)
@zhaoguohao
zhaoguohao / ColorChanger.cs
Created June 4, 2025 12:51 — forked from hecomi/ColorChanger.cs
PicturesGenerator Example
using UnityEngine;
namespace WeddingMovie
{
public class ColorChanger : MonoBehaviour
{
public Color color = Color.white;
[ContextMenu("ChangeColor")]
@zhaoguohao
zhaoguohao / letterSpacing.cs
Created May 20, 2025 10:48 — forked from valentincognito/letterSpacing.cs
Letter spacing script for Unity
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
/*
http://forum.unity3d.com/threads/adjustable-character-spacing-free-script.288277/
Unity 5.4 compatible version
Produces an simple tracking/letter-spacing effect on UI Text components.
Set the spacing parameter to adjust letter spacing.
@zhaoguohao
zhaoguohao / CustomThumbnail.cs
Created March 7, 2025 10:25 — forked from unitycoder/CustomThumbnail.cs
Save Thumbnails for Scenes (unity editor script)
using System.IO;
using UnityEditor;
using UnityEngine;
namespace UnityLibrary
{
[CustomEditor(typeof(SceneAsset))]
public class CustomThumbnail : Editor
{
public override bool HasPreviewGUI() => true;
@zhaoguohao
zhaoguohao / CameraFollow.cs
Created September 5, 2024 13:37 — forked from yasirkula/CameraFollow.cs
A camera follow script with numerous parameters for Unity
using UnityEngine;
[ExecuteInEditMode]
public class CameraFollow : MonoBehaviour
{
[Tooltip( "Object to follow" )]
public Transform Target;
[Tooltip( "Target distance to the followed object" )]
public Vector3 DistanceToTarget = new Vector3( 0f, 3f, -5f );
@zhaoguohao
zhaoguohao / HierarchyFolderObject.cs
Created September 5, 2024 13:35 — forked from yasirkula/HierarchyFolderObject.cs
Create folder objects in Hierarchy that automatically detach all their children while building the game (for Unity3D)
#define ENABLE_LOGGING // Logs the folder objects that were flattened to the console
//#define SIMULATE_BUILD_BEHAVIOUR_ON_PLAY_MODE // Simulates Execution.AtBuildTime when entering Play Mode in the Editor, as well
#if UNITY_EDITOR
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEngine.SceneManagement;
using System.Collections.Generic;
using System.Reflection;
#endif
@zhaoguohao
zhaoguohao / DirectoryComparer.cs
Created September 5, 2024 13:35 — forked from yasirkula/DirectoryComparer.cs
Compare the contents of two directories and apply any changes to the target directory to synchronize these two directories
#define COMPARE_FILE_CONTENTS
#if COMPARE_FILE_CONTENTS
#define USE_THREADS
#endif
using System;
using System.Collections.Generic;
using System.IO;
#if USE_THREADS
using System.Threading;