Skip to content

Instantly share code, notes, and snippets.

@ruccho
ruccho / WolfAutoTile.cs
Last active January 7, 2018 10:18
ウディタ規格のオートタイルに対応したやつ
using System;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace UnityEngine.Tilemaps
{
[Serializable]
@ruccho
ruccho / DraggableGraphicWithEventTrigger.cs
Last active July 21, 2019 06:54
Unity uGUI要素をドラッグ可能にするスクリプト
using UnityEngine;
using UnityEngine.EventSystems;
[RequireComponent(typeof(EventTrigger))]
public class DraggableGraphicWithEventTrigger : MonoBehaviour
{
//ドラッグ開始地点とこのオブジェクトの原点との差分ベクトル
private Vector2 mouseOffset;
using UnityEngine.Scripting;
namespace UnityEngine.Tilemaps
{
public abstract class TileBase : ScriptableObject
{
public virtual bool GetTileAnimationData(Vector3Int position, ITilemap tilemap, ref TileAnimationData tileAnimationData);
//このタイルの情報を返す
public virtual void GetTileData(Vector3Int position, ITilemap tilemap, ref TileData tileData);
@ruccho
ruccho / WolfAutoTile.cs
Created February 17, 2018 10:28
An extension for Unity Tilemap.(Compatible with animation)
using System;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace UnityEngine.Tilemaps
{
[Serializable]
public class WolfAutoTile : TileBase
@ruccho
ruccho / PolygonCollider2DHelper.cs
Created March 26, 2018 07:48
A helper for CompositeCollider2D (using PolygonCollider2D) to create circle polygon
//CompositeCollider2D can use only BoxCollider2D and PolygonCollider2D.
//This script helps your projects to use circle for CompositeCollider2D through creating circle polygon and setting it to PolygonCollider2D.
//Attach this to the GameObject, insert radius and number of points and click "Create Circle Polygon".
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
[RequireComponent(typeof(PolygonCollider2D))]
public class PolygonCollider2DHelper : MonoBehaviour
@ruccho
ruccho / Water-R.shader
Last active June 8, 2019 15:12
2D simple water with reflection for Unity. Create empty GameObject with SpriteRenderer and attach the material and the script.
Shader "Effect/Water-R"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_NormalA("Normal A", 2D) = "" {}
_NormalAAmount("Normal A Amount", Range(0,100)) = 50
_NormalASpeed("Normal A Speed", Float) = 1.0
_NormalB("Normal B", 2D) = "" {}
_NormalBAmount("Normal B Amount", Range(0,100)) = 50
----------------------------------------------------------------------
-- Generate Normal Map
--
-- It works only for RGB color mode.
----------------------------------------------------------------------
if app.apiVersion < 1 then
return app.alert("This script requires Aseprite v1.2.10-beta3")
end
@ruccho
ruccho / Generate Normal Map for all frames.lua
Last active February 24, 2024 10:48
Lua script for Aseprite that generates normal map automatically from all frames of selected layers.
----------------------------------------------------------------------
-- Generate Normal Map
--
-- It works only for RGB color mode.
----------------------------------------------------------------------
if app.apiVersion < 1 then
return app.alert("This script requires Aseprite v1.2.10-beta3")
end
@ruccho
ruccho / topmost.hsp
Created May 24, 2019 13:55
HSPでTopMostなウィンドウにするやつ
#include "user32.as"
#define HWND_TOPMOST -1
#define SWP_NOSIZE 0x0001
#define SWP_NOMOVE 0x0002
SetWindowPos hwnd, HWND_TOPMOST, 0, 0, 0, 0, (SWP_NOMOVE | SWP_NOSIZE)
stop
@ruccho
ruccho / PixelOutline.cs
Last active June 16, 2019 15:31
uGUIのアウトラインをドットのフォントでキレイに表示するやつ。Textにアタッチして使えます。
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace Ruccho.Utilities
{
public class PixelOutline : Shadow
{
[SerializeField]
private bool EightDirection;