-
-
Save todorok1/5c79ce43070037c9092abc6c2d6405c1 to your computer and use it in GitHub Desktop.
シンプルRPGチュートリアル第44回 キャラクターの移動を行うクラスを管理するクラス
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
using System.Collections.Generic; | |
using UnityEngine; | |
namespace SimpleRpg | |
{ | |
/// <summary> | |
/// キャラクターの移動を行うクラスを管理するクラスです。 | |
/// </summary> | |
public class CharacterMoverManager : MonoBehaviour | |
{ | |
/// <summary> | |
/// キャラクターの移動を行うクラスのリストです。 | |
/// </summary> | |
List<CharacterMover> _characterMovers = new(); | |
/// <summary> | |
/// キャラクターの移動を行うクラスを登録します。 | |
/// </summary> | |
/// <param name="characterMover">キャラクターの移動を行うクラス</param> | |
public void RegisterCharacterMover(CharacterMover characterMover) | |
{ | |
_characterMovers.Add(characterMover); | |
} | |
/// <summary> | |
/// キャラクターの移動とアニメーションを停止します。 | |
/// </summary> | |
public void StopCharacterMover() | |
{ | |
foreach (var characterMover in _characterMovers) | |
{ | |
if (characterMover == null) | |
{ | |
continue; | |
} | |
characterMover.StopAnimation(); | |
characterMover.StopMoving(); | |
} | |
} | |
/// <summary> | |
/// キャラクターの移動とアニメーションを再開します。 | |
/// </summary> | |
public void ResumeCharacterMover() | |
{ | |
foreach (var characterMover in _characterMovers) | |
{ | |
if (characterMover == null) | |
{ | |
continue; | |
} | |
characterMover.ResumeAnimation(); | |
characterMover.ResumeMoving(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment