Skip to content

Instantly share code, notes, and snippets.

@enue
enue / InputActionExtension.cs
Last active June 6, 2021 08:40
subscribe InputAction callbacks
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
public static class InputActionExtension
{
static public System.IDisposable SubscribePerform(this InputAction action,
System.Action<InputAction.CallbackContext> callback)
{
@enue
enue / ReactiveDictionaryExtentions.cs
Created December 25, 2020 13:16
ReactiveDictionary.ObserveValue
using UniRx;
namespace TSKT
{
public static class ReactiveDictionaryExtentions
{
public static ReadOnlyReactiveProperty<V> ObserveValue<K, V>(this ReactiveDictionary<K, V> dict, K key, V defaultValue = default)
{
var comparer = EqualityComparer<K>.Default;
var hashCode = comparer.GetHashCode(key);
@enue
enue / UnlimitedArray2.cs
Last active May 24, 2019 09:08
for Unity2018.4.0f1
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace TSKT
{
public class UnlimitedArray2<T>
{
T[,] array;
public Vector2Int Min { get; private set; }
@enue
enue / Compression.cs
Last active November 30, 2018 23:30
Deflate圧縮
using UnityEngine;
using System.Collections;
using System;
using System.Text;
using System.IO;
using System.IO.Compression;
// Unity2018.3.0b12
namespace TSKT
@enue
enue / NativeBitArray.cs
Created October 9, 2018 23:17
NativeBitArray for Unity2018.2.8f1
using System;
using System.Collections;
using System.Collections.Generic;
using Unity.Collections;
using UnityEngine;
namespace TSKT
{
public struct NativeBitArray : IDisposable, IEnumerable<bool>
{
@enue
enue / NativeList.cs
Last active October 9, 2018 23:17
NativeArray for Unity2018.2.8f1
using System;
using System.Collections;
using System.Collections.Generic;
using Unity.Collections;
using UnityEngine;
namespace TSKT
{
public struct NativeList<T> : IDisposable, IEnumerable<T>
where T : struct
@enue
enue / SnapAngleSample.cs
Last active May 9, 2018 20:42
アナログスティックの入力を8方向にスナップする
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SnapAngleSample : MonoBehaviour
{
private void Update()
{
var v = Input.GetAxis("Vertical");
var h = Input.GetAxis("Horizontal");
@enue
enue / SpreadSheet.cs
Last active April 9, 2019 06:21
かんたんスプレッドシートapi
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
using System.Linq;
// https://developers.google.com/sheets/guides/concepts?hl=ja
namespace TSKT
{
@enue
enue / Sprite-Heat.shader
Created March 16, 2018 11:08
聖剣2ボス撃破っぽい
// Copyright (c) 2016 Unity Technologies
// Released under the MIT license
Shader "Sprites/Heat"
{
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
[MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
@enue
enue / HeatShimmer.cs
Last active March 1, 2017 23:31
[Unity]陽炎エフェクト
using System;
using UnityEngine;
using UnityStandardAssets.ImageEffects;
namespace TSKT
{
[AddComponentMenu("TSKT/Image Effects/HeatShimmer")]
[RequireComponent(typeof(Camera))]
public class HeatShimmer : ImageEffectBase
{