Skip to content

Commit e32f279

Browse files
author
k-okawa
committed
update readme
1 parent 640a007 commit e32f279

2 files changed

Lines changed: 46 additions & 6 deletions

File tree

README.ja.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Editorツールも提供しているので、簡単にステートを組むこ
2929

3030
(スクリプト上で組むことも可能です)
3131

32-
![image](https://user-images.githubusercontent.com/49301086/137613577-d510a77c-0231-4e76-bf0f-a6f16a2ae506.png)
32+
![image](https://user-images.githubusercontent.com/49301086/183348165-6042c870-ac33-479a-b5fa-af210f345352.png)
3333

3434

3535
## インストール
@@ -64,6 +64,10 @@ https://github.com/k-okawa/UniTaskStateMachine.git?path=Assets/Bg/UniTaskStateMa
6464
openupm add com.bg.unitaskstatemachine
6565
```
6666

67+
### UnityPackage
68+
69+
[リリースページ](https://github.com/k-okawa/UniTaskStateMachine/releases)からダウンロード可能です。
70+
6771
## 使い方
6872
### 1.StateMachineBehaviour追加
6973
StateMachineBehaviourをAddComponentします。
@@ -75,7 +79,7 @@ StateMachineBehaviourをAddComponentします。
7579

7680
またはWindow/BG UniTaskStateMachine/StateMachineGraphでグラフエディタを開くことができます。
7781

78-
![image](https://user-images.githubusercontent.com/49301086/143770686-8efd36c8-35fc-40a5-a1ec-4862a2dda9e3.png)
82+
![image](https://user-images.githubusercontent.com/49301086/183349573-556b2bfb-968c-40ef-91b9-acde45bf5f65.png)
7983

8084
### 3.State追加方法
8185
#### 3-1.StateBehaviourを追加
@@ -85,6 +89,8 @@ StateMachineBehaviourがアタッチされているGameObjectにBaseStateCompone
8589

8690
※BaseStateComponentを直接AddComponentしないでください。
8791

92+
※同じStateComponentを同じゲームオブジェクトにAddComponentしないでください。
93+
8894
****
8995
```c#
9096
namespace Bg.UniTaskStateMachine.Tests.BasicSceneTest
@@ -115,7 +121,7 @@ namespace Bg.UniTaskStateMachine.Tests.BasicSceneTest
115121

116122
Graphエディタ上で右クリックし、CreateStateでState追加
117123

118-
![image](https://user-images.githubusercontent.com/49301086/143770989-faa1a688-2ecd-4407-87d7-3e9b2a4c570a.png)
124+
![image](https://user-images.githubusercontent.com/49301086/183352350-6de6bec5-b304-4a1a-b668-049c6841a9eb.png)
119125

120126
追加されているクラス名が表示され選択可能になります。
121127

@@ -148,6 +154,20 @@ Stateを右クリックし、Set as Entryを選択することで設定するこ
148154

149155
![image](https://user-images.githubusercontent.com/49301086/143771406-b0e40166-fd07-4091-8e98-a5cac1ba83f2.png)
150156

157+
### TriggerNextTransition
158+
159+
トランジションに条件を指定する以外にも、IDを指定してステートを遷移させることが可能です。
160+
161+
トランジションIDはC#のフィールド名で使用可能なアッパーキャメルケースを推奨します。
162+
163+
すべてのトランジションIDを決めた後、GenerateTransitionIdConstボタンを使用して定数のテンプレートコードを生成できます。
164+
165+
![image](https://user-images.githubusercontent.com/49301086/183354384-8c33ea1d-53a3-4bae-95f1-2011c0ddd660.png)
166+
167+
最後に、"StateMachine.TriggerNextTransition(string transitionId)"を呼び出すだけで好きなタイミングでステート遷移が可能です
168+
169+
引数に文字列を直接渡すことができますが、生成されたクラスの読み取り専用のフィールドで渡すことを推奨します。
170+
151171
## API Reference
152172
### StateMachine
153173
StateMachineBehaviourのStateMachineプロパティからアクセスできます。

README.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ In addition, the state transition method corresponds to the following.
2727

2828
This package also provide an Editor tool, so you can easily create states.
2929

30-
![image](https://user-images.githubusercontent.com/49301086/137613577-d510a77c-0231-4e76-bf0f-a6f16a2ae506.png)
30+
![image](https://user-images.githubusercontent.com/49301086/183348165-6042c870-ac33-479a-b5fa-af210f345352.png)
3131

3232

3333
## Installation
@@ -60,6 +60,10 @@ https://github.com/k-okawa/UniTaskStateMachine.git?path=Assets/Bg/UniTaskStateMa
6060
openupm add com.bg.unitaskstatemachine
6161
```
6262

63+
### UnityPackage
64+
65+
You can download unity package in [release page](https://github.com/k-okawa/UniTaskStateMachine/releases).
66+
6367
## How to use
6468
### 1.Add StateMachineBehaviour Component
6569

@@ -71,7 +75,7 @@ GraphEditorOpen of StateMachineBehaviour added in 1
7175

7276
Or you can open the graph editor with Window / BG UniTaskStateMachine / StateMachineGraph.
7377

74-
![image](https://user-images.githubusercontent.com/49301086/143770686-8efd36c8-35fc-40a5-a1ec-4862a2dda9e3.png)
78+
![image](https://user-images.githubusercontent.com/49301086/183349573-556b2bfb-968c-40ef-91b9-acde45bf5f65.png)
7579

7680
### 3.How to add state
7781
#### 3-1.Add StateBehaviour
@@ -83,6 +87,8 @@ Add a Component that inherits BaseStateComponent to the GameObject to which Stat
8387

8488
* Do not addBaseStateComponent directly.
8589

90+
* Do not add same state component
91+
8692
**Example**
8793
```c#
8894
namespace Bg.UniTaskStateMachine.Tests.BasicSceneTest
@@ -113,7 +119,7 @@ namespace Bg.UniTaskStateMachine.Tests.BasicSceneTest
113119

114120
Right-click on the Graph editor and select Create State to add State.
115121

116-
![image](https://user-images.githubusercontent.com/49301086/143770989-faa1a688-2ecd-4407-87d7-3e9b2a4c570a.png)
122+
![image](https://user-images.githubusercontent.com/49301086/183352350-6de6bec5-b304-4a1a-b668-049c6841a9eb.png)
117123

118124
The added class name will be displayed and can be selected.
119125

@@ -149,6 +155,20 @@ It can be set by right-clicking on the State and selecting Set as Entry.
149155

150156
![image](https://user-images.githubusercontent.com/49301086/143771406-b0e40166-fd07-4091-8e98-a5cac1ba83f2.png)
151157

158+
### TriggerNextTransition
159+
160+
It is possible to translate state manually by transition id without specify condition method.
161+
162+
Transition id is recommended upper camel case that can use in C# field name.
163+
164+
After define transition id, you can generate transition id constant template code by GenerateTransitionIdConst button.
165+
166+
![image](https://user-images.githubusercontent.com/49301086/183354384-8c33ea1d-53a3-4bae-95f1-2011c0ddd660.png)
167+
168+
Finally, call "StateMachine.TriggerNextTransition(string transitionId)" for manual state transition.
169+
170+
It is able to call with string direct writing, but recommend with readonly string field in the generated template class.
171+
152172
## API Reference
153173
### StateMachine
154174
It can be accessed from the StateMachine property of the StateMachineBehaviour.

0 commit comments

Comments
 (0)