Skip to content

Instantly share code, notes, and snippets.

View litefeel's full-sized avatar
🎯
I may be slow to respond.

litefeel litefeel

🎯
I may be slow to respond.
View GitHub Profile
@litefeel
litefeel / BillBoard2D.cs
Created June 21, 2017 08:33
unity ui sorting
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BillBoard2D : MonoBehaviour {
public Camera m_Camera;
void Update()
{
@litefeel
litefeel / TriggerContainerEditor.cs
Created May 17, 2018 01:50 — forked from bzgeb/TriggerContainerEditor.cs
Example Drag & Drop area in a custom inspector for the Unity editor
using UnityEngine;
using System.Collections;
using UnityEditor;
[CustomEditor (typeof(TriggerContainer))]
public class TriggerContainerEditor : Editor
{
private SerializedObject obj;
@litefeel
litefeel / ContentSizeByParent.cs
Created July 10, 2018 13:00
Unity 根据父对象的大小,按比例设置该对象的尺寸
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
[AddComponentMenu("Layout/Content Size By Parent", 143)]
[ExecuteInEditMode]
[RequireComponent(typeof(RectTransform))]
@litefeel
litefeel / hsv_rgb.shader
Created July 27, 2018 06:18
shader: HSV <-> RGB
// https://blog.csdn.net/mobilebbki399/article/details/50603461
float3 RGB2HSV(float3 c)
{
float4 K = float4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
float4 p = lerp(float4(c.bg, K.wz), float4(c.gb, K.xy), step(c.b, c.g));
float4 q = lerp(float4(p.xyw, c.r), float4(c.r, p.yzx), step(p.x, c.r));
float d = q.x - min(q.w, q.y);
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
public class TouchArea : Graphic
{
protected override void OnEnable()
{
base.OnEnable();
@litefeel
litefeel / BarycentricCoordinates.cs
Last active September 13, 2018 07:44
BarycentricCoordinates.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// https://rhetty.github.io/2018/03/20/三角形线性插值——重心坐标/
// https://zh.wikipedia.org/wiki/笛卡尔坐标系
// https://en.wikipedia.org/wiki/Barycentric_coordinate_system
public struct BarycentricCoordinates
{
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"version": 2,
"blocks": [
{
"type": "prompt",
"alignment": "left",
"segments": [
{