{"id":15160774,"url":"https://github.com/kuritaro1122/objectordercontroller","last_synced_at":"2026-01-20T07:32:22.549Z","repository":{"id":170530472,"uuid":"524553792","full_name":"kuritaro1122/ObjectOrderController","owner":"kuritaro1122","description":"[Unity] オブジェクトに命令を付与する.","archived":false,"fork":false,"pushed_at":"2023-02-06T12:48:30.000Z","size":32,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-13T22:16:56.523Z","etag":null,"topics":["csharp","unity","unity-scripts"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kuritaro1122.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-14T02:24:05.000Z","updated_at":"2022-09-28T01:26:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"a1db8113-f54c-4d4f-af36-e59c7e60603f","html_url":"https://github.com/kuritaro1122/ObjectOrderController","commit_stats":null,"previous_names":["kuritaro1122/objectordercontroller"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuritaro1122%2FObjectOrderController","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuritaro1122%2FObjectOrderController/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuritaro1122%2FObjectOrderController/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuritaro1122%2FObjectOrderController/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kuritaro1122","download_url":"https://codeload.github.com/kuritaro1122/ObjectOrderController/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247724872,"owners_count":20985596,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","unity","unity-scripts"],"created_at":"2024-09-26T23:22:54.162Z","updated_at":"2026-01-20T07:32:22.543Z","avatar_url":"https://github.com/kuritaro1122.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ObjectOrderController\n\nMonoBehaviourを継承したクラスに命令を付与し, 非同期的に逐次実行する.\nこのクラスを継承することで, 直接メンバ関数の呼び出しを予約することができ, ステートを管理しながら命令を逐次実行する.\\\n[MovementManager](https://github.com/kuritaro1122/MovementManager/) や [RotateManager](https://github.com/kuritaro1122/RotateManager) と組み合わせることで, 敵やボスを作ることが可能.\n\n※[FunctionExecutor](https://github.com/kuritaro1122/FunctionExecutor/), [EntityActionCon](https://github.com/kuritaro1122/EntityActionCon) の完全上位互換です.\n\n# Requirement\n\n* UnityEngine\n* System\n* System.Collections\n* System.Collections.Generic\n\n# Usage\n① 任意のクラスにObjectOrderController\u003c\u003eを継承\\\n② Set関数で命令を付与\\\n③ Execute関数で実行\n```cs\nclass Hoge : ObjectOrderController\u003cHoge\u003e {\n    void Start() {\n        float seconds = 1f;\n        bool flag1 = false;\n        \n        // 命令を付与\n        base.SetAction(m =\u003e Debug.Log($\"{m} start\"))\n        .SetYield(new WaitForSeconds(seconds))\n        .SetAction(() =\u003e Debug.Log($\"seconds {seconds}\"))\n        .SetYield(new WaitUntil(flag1))\n        .SetAction(m =\u003e Debug.Log($\"{m} end\"))\n\n        // 命令を実行\n        .Execute();\n    }\n}\n```\n```cs\nclass Hoge2 : ObjectOrderController\u003cHoge2\u003e {\n    const bool Interrupt = true;\n    const bool NoInterrupt = false;\n    enum State {\n        Sleep = 0,\n        Awake = 1,\n        Stay = 2,\n        Attack = 3,\n    }\n    static bool SleepCondition(Hoge2 self) {\n        // return sleep condition\n    }\n    static bool AwakeCondition(Hoge2 self) {\n        // return awake condition\n    }\n    static bool AttackCondition(Hoge2 self) {\n        // return attack condition\n    }\n\n    void Start() {\n        // Sleep\n        base.CreateNode((int)State.Sleep, loop: true, (Interrupt, (int)State.Awake, AwakeCondition))\n        .SetAction(() =\u003e Debug.Log(\"zz..\"))\n        .SetYield(new WaitForSeconds(2f));\n        // Awake\n        base.CreateNode((int)State.Awake, nextIndex: (int)State.Stay)\n        .SetAction(() =\u003e Debug.Log(\"Awake\"))\n        // Stay\n        base.CreateNode((int)State.Stay, loop: true, (Interrupt, (int)State.Attack, AttackCondition), (Interrupt, (int)State.Sleep, SleepCondition))\n        .SetAction(() =\u003e Debug.Log(\"buzz!!\"))\n        .SetYield(new WaitForSeconds(1f));\n        // Attack\n        base.CreateNode((int)State.Attack, (NoInterrupt, (int)State.Stay, s =\u003e !AttackCondition(s)))\n        .SetCoroutine(AttackCoroutine)\n\n        base.Execute((int)State.Sleep); // First select node index.\n    }\n\n    static IEnumerator AttackCoroutine(Hoge2 self) {\n        Debug.Log(\"Attack1\");\n        yield return new WaitForSeconds(0.5f);\n        Debug.Log(\"Attack2\");\n        yield return new WaitForSeconds(3f);\n        Debug.Log(\"Attack3\");\n    }\n}\n```\n\n## Public Variable\n```cs\nT Self { get; }\nint NodeIndex { get; }\nint CurrentNodeLoopedCount { get; }\nbool Running { get; }\n```\n## Public Function\n```cs\n// Node\nObjectOrderController\u003cT\u003e CreateNode(int index, bool loop = false, params (bool, int, Func\u003cT, bool\u003e)[] nodeTransitions)\nObjectOrderController\u003cT\u003e CreateNode(int index, int nextIndex, params (bool, int, Func\u003cT, bool\u003e)[] nodeTransitions)\nObjectOrderController\u003cT\u003e CreateNode(int index, params (bool, int ,Func\u003cT, bool\u003e)[] nodeTransitions)\n// Set order\nObjectOrderController\u003cT\u003e Set(params IOrder\u003cT\u003e[] orders)\nObjectOrderController\u003cT\u003e SetYield(YieldInstruction yieldInstruction)\nObjectOrderController\u003cT\u003e SetYield(CustomYieldInstruction yieldInstruction)\nObjectOrderController\u003cT\u003e SetYield(Func\u003cT, YieldInstruction\u003e yieldInstruction)\nObjectOrderController\u003cT\u003e SetYield(Func\u003cT, CustomYieldInstruction\u003e yieldInstruction)\nObjectOrderController\u003cT\u003e SetAction(Action\u003cT\u003e action)\nObjectOrderController\u003cT\u003e SetAction(Action action)\nObjectOrderController\u003cT\u003e SetCoroutine(Func\u003cT, IEnumerator\u003e enumerator, bool isNotSync = false)\nObjectOrderController\u003cT\u003e SetCoroutine(Func\u003cIEnumerator\u003e enumerator, bool isNotSync = false)\nCoroutine ExtraOrder(IOrder\u003cT\u003e order)\nCoroutine ExtraOrder(Func\u003cIEnumerator\u003cT\u003e\u003e enumerator)\nCoroutine ExtraOrder(Func\u003cIEnumerator\u003e enumerator)\n// Control\nvoid Execute(int index = 0)\nObjectOrderController\u003cT\u003e StopAll()\n// void Execute(int index = 0, Action\u003cT\u003e finishCallBack = null)\n// void Execute(int index = 0, Action finishCallBack = null)\n// void Execute(Action\u003cT\u003e finishCallBack = null)\n// void Execute(Action finishCallBack = null)\n```\n\n# Note\n* StartCoroutineの代わりにExtraOrderを使用してください. ExtraOrderを使用すると内部的にStartCoroutineが呼ばれ, Nodeによって監視されます. Nodeが変更された際には他の命令と同様に中断されます.\n* SetCoroutineのisNotSyncをtrueにすると後ろの命令を待たせません.\n\n# License\n\n\"ObjectOrderController\" is under [MIT license](https://en.wikipedia.org/wiki/MIT_License).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkuritaro1122%2Fobjectordercontroller","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkuritaro1122%2Fobjectordercontroller","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkuritaro1122%2Fobjectordercontroller/lists"}