Skip to content

Instantly share code, notes, and snippets.

View HassakuTb's full-sized avatar
💭
🍊

Hassaku HassakuTb

💭
🍊
View GitHub Profile
@HassakuTb
HassakuTb / TransformExtentions.cs
Created August 19, 2018 10:04
Destroy all children of GameObject
using UnityEngine;
public static partial class TransformExtentions {
public static void DestroyAllChildren(this Transform tf) {
foreach(Transform t in tf) {
GameObject.Destroy(t.gameObject);
}
tf.DetachChildren();
}
@HassakuTb
HassakuTb / XorShift.cs
Created August 16, 2018 09:36
XorShift乱数生成器
using System;
namespace RandomGen {
[Serializable]
public abstract class RandomGenerator {
/// <summary>
/// シード値
/// </summary>
public abstract uint Seed {
@HassakuTb
HassakuTb / IEnumerableExtensions.cs
Created August 13, 2018 05:10
ForEach extension for IEnumerable
public static partial class IEnumerableExtensions {
public static void ForEach<T>(this IEnumerable<T> e, Action<T> action) {
foreach(T item in e) {
action(item);
}
}
}
@HassakuTb
HassakuTb / Clickable.cs
Created August 10, 2018 08:18
Detect click for Unity UI Component
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
namespace UI {
// クリック可能なUIコンポーネント
[RequireComponent(typeof(EventTrigger))]
public class Clickable : MonoBehaviour {
// クリック時の挙動
@HassakuTb
HassakuTb / DoubleClicable.cs
Last active August 16, 2018 14:06
Detect double click event for unity ui
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
using UniRx;
namespace UI {
// ダブルクリック可能なUIコンポーネント
[RequireComponent(typeof(EventTrigger))]
public class DoubleClickable : MonoBehaviour{
@HassakuTb
HassakuTb / getcomp.snippet
Created July 17, 2018 07:12
CS Snippet GetComponent
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>getcomp</Title>
<Shortcut>getcomp</Shortcut>
<Description>dependency injection using Get Component</Description>
<Author></Author>
</Header>
<Snippet>
@HassakuTb
HassakuTb / reqc
Last active August 16, 2018 14:11
CS Snippet RequireComponent
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>reqc</Title>
<Shortcut>reqc</Shortcut>
<Description>ReuireComponentAttribute</Description>
<Author></Author>
</Header>
<Snippet>
@HassakuTb
HassakuTb / rrp.snippet
Last active July 17, 2018 07:01
CS Snipet ReadOnlyReactiveProperty definition
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>rrp</Title>
<Shortcut>rrp</Shortcut>
<Description>ReadOnly Reactive Property interface definition</Description>
<Author></Author>
</Header>
<Snippet>
@HassakuTb
HassakuTb / Commit.cs
Last active November 25, 2017 09:50
Create asset contains Git commit id that was commited at Build Unity project
using UnityEngine;
namespace Git {
public class Commit : ScriptableObject{
public string id;
public static Commit Create(string commitId) {
var instance = CreateInstance<Commit>();
@HassakuTb
HassakuTb / Shaker.cs
Created January 1, 2017 07:35
震える
/**
NYSL Version 0.9982 (en) (Unofficial)
----------------------------------------
A. This software is "Everyone'sWare". It means:
Anybody who has this software can use it as if he/she is
the author.
A-1. Freeware. No fee is required.
A-2. You can freely redistribute this software.
A-3. You can freely modify this software. And the source
may be used in any software with no limitation.