Skip to content

Instantly share code, notes, and snippets.

View HassakuTb's full-sized avatar
💭
🍊

Hassaku HassakuTb

💭
🍊
View GitHub Profile
@HassakuTb
HassakuTb / PlayerLoopInserter.cs
Created April 12, 2022 07:47
assist to construct my own PlayerLoop
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine.LowLevel;
namespace HassakuLab.Utils.PlayerLoops
{
/// <summary>
/// utility to insert PlayerLoop subsystem
/// </summary>
@HassakuTb
HassakuTb / PlayerLoopViewer.cs
Created April 12, 2022 04:36
EditorWindow to display PlayerLoop in Unity.
using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEngine.LowLevel;
namespace HassakuLab.Utils.PlayerLoops.Editor
{
public class PlayerLoopViewer : EditorWindow
{
@HassakuTb
HassakuTb / NumericValueStruct.cs
Last active December 24, 2021 12:07
template of numeric value type for rider
using System;
// ReSharper disable RedundantCast
// ReSharper disable UnusedMember.Global
// ReSharper disable RedundantOverflowCheckingContext
namespace $Namespace${
public readonly struct $StructName$ : IEquatable<$StructName$>, IComparable<$StructName$> {
readonly $Type$ value;
public $StructName$($Type$ value){
@HassakuTb
HassakuTb / DynamicBox.cs
Created September 24, 2021 14:56
Move box with collider but without rigidbody in Unity
using UnityEngine;
namespace HassakuLab.Physics2D.BoxSystem
{
/**
* Rigidbody for BoxSystem
*/
[RequireComponent(typeof(Rigidbody2D))]
[RequireComponent(typeof(BoxCollider2D))]
public class DynamicBox : MonoBehaviour
@HassakuTb
HassakuTb / AndroidManifest.xml
Last active May 12, 2023 09:44
Reimplementation of UnityPlayerActivity with AppCompatActivity and Kotlin
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hassakulab.unitybridgesample"
xmlns:tools="http://schemas.android.com/tools">
<application
android:allowBackup="true"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.UnityBridgeSample">
@HassakuTb
HassakuTb / Actor.cs
Created June 13, 2020 15:29
ヒットストップ
using Cysharp.Threading.Tasks;
using UnityEngine;
/// <summary>
/// アクタークラス
/// </summary>
[RequireComponent(typeof(HitStunHandler))]
public class Actor : MonoBehaviour
{
/// <summary>
@HassakuTb
HassakuTb / CubeForPool.cs
Created June 6, 2020 13:38
オブジェクトプール
using System.Collections;
using UnityEngine;
public class CubeForPool : MonoBehaviour, IPoolable<CubeForPool>
{
private ObjectPool<CubeForPool> ObjectPool { get; set; }
public void Initialize(ObjectPool<CubeForPool> objectPool)
{
ObjectPool = objectPool;
export const generateUuid: () => string = () =>{
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".split("")
.map(c =>{
if(c === "x"){
return Math.floor(Math.random() * 16).toString(16);
}
else if(c === "y"){
return Math.floor(Math.random() * 4 + 8).toString(16);
}
else{
int countParPage = 10; // 1ぺーじあたりのアイテム数
int allItems = 100; // 全アイテム数
// ページ数
int PageCount => (allItems + countParPage - 1) / countParPage;
@HassakuTb
HassakuTb / BeatTransmitter.cs
Last active August 10, 2019 22:22
beat transmitter using UniRx
using System;
using UniRx;
using UnityEngine;
namespace KotonohaAnone.Presenter
{
public class BeatTransmitter : MonoBehaviour
{
[SerializeField] private AudioSource audioSource;
[SerializeField] private float bpm;