Skip to content

Instantly share code, notes, and snippets.

@todorok1
Created January 1, 2025 13:17
Show Gist options
  • Select an option

  • Save todorok1/edf056cf999f656d00343a1b4c37316a to your computer and use it in GitHub Desktop.

Select an option

Save todorok1/edf056cf999f656d00343a1b4c37316a to your computer and use it in GitHub Desktop.
シンプルRPGチュートリアル第6回 操作キャラクターの移動を制御するクラス
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