For AI agents: the complete documentation index is available at /npc-mentality/ja/llms.txt, the full documentation bundle is available at /npc-mentality/ja/llms-full.txt, and this page is available as Markdown at /npc-mentality/ja/usage/rumor.md.

噂システム

情報が NPC の間を流れるにつれて内容が変化していきます。

概要

プレイヤーがボスを倒す
    ↓
NPC1: "誰かがドラゴンを倒したって?"
    ↓
NPC2: "違うよ、魔法使いらしいよ"
    ↓
NPC3: "魔王が死んだらしい"

コンポーネント

RumorSystem — MonoBehaviour。

フィールド型デフォルト説明
MutationChancefloat0.3f変形確率(0〜1)
MutationSuffixesList<string>デフォルト4つ変形時に追加される文章
ActiveRumorsList<RumorData>—現在進行中の噂リスト

API

rumorSystem.SpreadRumor("誰かがドラゴンを倒した", sourceNpcId: "player");

var rumor = rumorSystem.ActiveRumors[^1];
rumorSystem.PassRumor(rumor, "npc_01");

サンプル

using NpcMentality;

public class RumorDemo : MonoBehaviour
{
    public RumorSystem rumorSystem;
    public string[] npcIds = { "blacksmith", "innkeeper", "farmer", "guard" };

    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);
        }
    }
}

ヒント

  • MutationChance = 0f — 変形なしで事実のみ伝播します。
  • MutationChance = 1f — 毎回必ず変形します。
  • RelationshipContagion と組み合わせると噂の内容と感情が同時に広がります。