Skip to content

Instantly share code, notes, and snippets.

@todorok1
Created June 29, 2025 08:56
Show Gist options
  • Select an option

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

Select an option

Save todorok1/6c3d406fcb5c1e34955c5707f54ba6c2 to your computer and use it in GitHub Desktop.
シンプルRPGチュートリアル第88回 イベントのまとまりを制御するクラス
using System.Collections.Generic;
using UnityEngine;
namespace SimpleRpg
{
/// <summary>
/// イベントのまとまりを制御するクラスです。
/// </summary>
public class EventFileData : MonoBehaviour
{
/// <summary>
/// 条件に応じたイベントの画像を制御するクラスへの参照です。
/// </summary>
[SerializeField]
EventGraphicController _eventGraphicController;
/// <summary>
/// イベントページのリストです。
/// </summary>
List<EventPage> _eventPages;
/// <summary>
/// イベントの処理を行うクラスへの参照です。
/// </summary>
EventProcessor _eventProcessor;
/// <summary>
/// イベントを処理するクラスへの参照をセットします。
/// </summary>
public void SetReference(EventProcessor eventProcessor)
{
_eventProcessor = eventProcessor;
}
/// <summary>
/// 対象のイベントページの処理を開始します。
/// </summary>
public void ExecuteEvent(RpgEventTrigger rpgEventTrigger)
{
SetUpEventPages();
var targetPage = GetEventPage(rpgEventTrigger);
if (targetPage == null)
{
SimpleLogger.Instance.Log($"実行可能なイベントページが見つかりませんでした。イベントのトリガー : {rpgEventTrigger}");
_eventProcessor.OnEventFinished();
return;
}
targetPage.StartEvent(_eventProcessor, this);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment