-
-
Save todorok1/edf056cf999f656d00343a1b4c37316a to your computer and use it in GitHub Desktop.
シンプルRPGチュートリアル第6回 操作キャラクターの移動を制御するクラス
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void Start() | |
| { | |
| CheckComponents(); | |
| GetCurrentPositionOnTilemap(); | |
| } | |
| /// * 中略 * /// | |
| /// <summary> | |
| /// 必要なコンポーネントへの参照を確認します。 | |
| /// </summary> | |
| void CheckComponents() | |
| { | |
| if (_animator == null) | |
| { | |
| _animator = gameObject.GetComponent<Animator>(); | |
| } | |
| } | |
| /// <summary> | |
| /// Tilemap上の論理的な座標を取得します。 | |
| /// </summary> | |
| void GetCurrentPositionOnTilemap() | |
| { | |
| if (_baseTilemap == null) | |
| { | |
| return; | |
| } | |
| _posOnTile = _baseTilemap.WorldToCell(gameObject.transform.position); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment