using NpcMentality;
public class RumorDemo : MonoBehaviour
{
public RumorSystem rumorSystem;
public string[] npcIds = { "blacksmith", "innkeeper", "farmer", "guard" };
private void Start()
{
rumorSystem.OnRumorPassed += (r, npcId) =>
Debug.Log($"[{npcId}] hop {r.HopCount}: \"{r.CurrentVersion}\"");
}
public void OnPlayerKillsDragon()
{
rumorSystem.SpreadRumor("누군가 용을 잡았다", "player");
StartCoroutine(SpreadToVillage());
}
private System.Collections.IEnumerator SpreadToVillage()
{
var rumor = rumorSystem.ActiveRumors[^1];
foreach (string npcId in npcIds)
{
yield return new WaitForSeconds(2f);
rumorSystem.PassRumor(rumor, npcId);
}
}
}