Skip to content

Instantly share code, notes, and snippets.

@dskjal
dskjal / EffectStack.cs
Last active November 14, 2016 19:05
Effect Stack クラス
class PlayerData{
public int HP;
// そのほかのパラメータ
}
enum EffectStatus{
TimeOut
}
interface IEffect{
@dskjal
dskjal / AbstructItem.cs
Last active November 14, 2016 19:17
アイテムの抽象化
enum ItemStatus{
Delete,
CannotUse
}
interface IItem{
ItemStatus Use();
//そのほかの GetName() のような便利なメソッド
}
@dskjal
dskjal / ItemDB.cs
Last active June 19, 2017 01:38
アイテムデータベースの例
struct ItemData{
int ItemID;
// その他のフィールド変数
}
class ItemDB{
private ItemData items[];
public ItemData this[int i]{
get{
return items[i]
}
@dskjal
dskjal / VariableWaitForSeconds.cs
Created September 29, 2016 03:06
Unity でヒープにごみを出さない WaitForSeconds
// BEGIN MIT LICENSE BLOCK //
//
// Copyright (c) 2016 dskjal
// This software is released under the MIT License.
// http://opensource.org/licenses/mit-license.php
//
// END MIT LICENSE BLOCK //
/* 使い方
[SerializeField]
float interval = 1;
@dskjal
dskjal / Coroutine.cs
Last active September 29, 2016 01:45
Unity でヒープにできるごみを減らすコルーチン
using UnityEngine;
using System.Collections;
public class Coroutine : MonoBehaviour {
[SerializeField]float interval = 1;
void Start () {
StartCoroutine(coroutine());
}
@dskjal
dskjal / InstancePool.cs
Last active September 26, 2016 03:10
Unity のプレハブをプールしておくコンテナ
// BEGIN MIT LICENSE BLOCK //
//
// Copyright (c) 2016 dskjal
// This software is released under the MIT License.
// http://opensource.org/licenses/mit-license.php
//
// END MIT LICENSE BLOCK //
/* 使い方
public GameObject Prefab;
private InstancePool enemyPool;
@dskjal
dskjal / unity_foreach_test.cs
Last active September 24, 2016 23:13
Unity は foreach でヒープにメモリを確保するか?
using UnityEngine;
public class NewBehaviourScript : MonoBehaviour {
readonly int ARRAY_LENGTH = 1000;
int[] values;
GameObject[] objects;
void Awake() {
objects = new GameObject[ARRAY_LENGTH];
@dskjal
dskjal / AutoBlink.cs
Last active September 24, 2016 12:32
ユニティちゃんの瞬きを滑らかにする
@dskjal
dskjal / load_external_texture.cs
Last active September 22, 2016 21:05
Unity で Mod をサポートする(外部リソースをロードする)
// BEGIN MIT LICENSE BLOCK //
//
// Copyright (c) 2016 dskjal
// This software is released under the MIT License.
// http://opensource.org/licenses/mit-license.php
//
// END MIT LICENSE BLOCK //
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
@dskjal
dskjal / snap_ik_fk.py
Last active July 7, 2019 20:57
Blender で IK/FK を一致させる
// BEGIN MIT LICENSE BLOCK //
//
// Copyright (c) 2019 dskjal
// This software is released under the MIT License.
// http://opensource.org/licenses/mit-license.php
//
// END MIT LICENSE BLOCK //
import bpy
from bpy.props import *
import mathutils