【3Dゲームエンジン】Unity 4at GAMEDEV
【3Dゲームエンジン】Unity 4 - 暇つぶし2ch553:名前は開発中のものです。
15/07/26 18:14:10.17 D3ATScL/.net
>>545
C#のSystem.ActionとかSystem.Funcの配列を使うと良いよ
Actionはvoidな関数、Funcは戻り値の型を指定して使う
// actionの配列
private System.Action<string> [] actionList;
// actionへ関数の設定
void Start () {
actionList = new System.Action<string>[10];
actionList[0] = Action1;
actionList[1] = Action2;
// more actions
}
// iの値で何かを実行
void ExecuteAction(int i)
{
actionList[i](i.ToString());
}
void Action1(string val)
{
Debug.Log("Action1:"+val);
}
void Action2(string val)
{
Debug.Log("Action2:"+val);
}
// and many funcs


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch