示例#1
0
    public void OnReceiveStatement(RHRegisteredStatement rs)
    {
        RHStatement    statement = rs.statement;
        RHSpeaker      speaker   = rs.speaker;
        RHConversation c         = rs.conversation;

        GetComponent <AITaskManager>()?.triggerEvent(new AIEVStatementReceived(c, statement, speaker));
        Dictionary <RHStat, float> results = new Dictionary <RHStat, float>();

        for (int i = 0; i < 5; i++)
        {
            RHStat s     = (RHStat)i;
            float  power = statement.GetPower(speaker, this, c, s);
            float  diff  = applyStatementModifiers(power, rs, s);
            if (diff == 0)
            {
                continue;
            }

            results[s] = diff;
            ModifyStat(speaker, c, s, diff);
        }
        statement.OnStatementReceived(speaker, this, c, results);
        RHManager.AddHistoryText(GetResponseString(statement, speaker, results));
    }
示例#2
0
    public virtual void AddIcons(DialogueOptionInitializer doi, RHSpeaker speaker, RHConversation conversation)
    {
        string timeStr = Time.ToString("F2") + " s";

        doi.AddTextIcon(timeStr, Color.white);
        for (int i = 0; i < 5; i++)
        {
            RHStat s            = (RHStat)i;
            float  sum          = 0;
            int    numListeners = 0;
            foreach (RHListener l in conversation.Listeners.Keys)
            {
                if (l == speaker.GetComponent <RHListener>())
                {
                    continue;
                }
                float f = GetPower(speaker, l, conversation, s);
                sum += f;
                numListeners++;
            }
            if (Mathf.Abs(sum) <= 1)
            {
                continue;
            }
            Color c = RHManager.ProportionToColor(GetBasePower(s), sum / numListeners);
            doi.AddIcon(RHManager.GetStatIcon(s), sum.ToString("F1"), c, (sum > 0) ? Color.white : Color.red);
        }
    }
示例#3
0
    public void ModifyStat(RHSpeaker s, RHConversation c, RHStat stat, float value, bool permanent = false)
    {
        if (stat == RHStat.CURRENT_PERSUASION_LEVEL)
        {
            c.ModifyListenerPersuasion(this, value);
            return;
        }

        if (stat == RHStat.EMOTIONS)
        {
            m_emotionalIntensity += value;
            return;
        }

        string             label = getModifierString(s, c, permanent);
        ImpressionModifier i     = new ImpressionModifier(label, value);

        if (!permanent)
        {
            if (!m_temporaryModifiers.ContainsKey(stat))
            {
                m_temporaryModifiers[stat] = new List <ImpressionModifier>();
            }
            m_temporaryModifiers[stat].Add(i);
        }

        GetComponent <Observer>().AddModifier(s.gameObject.name, RHStatToNoun(stat), i);
    }
示例#4
0
 private float applyStatementModifiers(float baseValue, RHRegisteredStatement rs, RHStat s)
 {
     foreach (RHPersonalityTrait t in m_traits)
     {
         baseValue = t.OnStatementUsed(baseValue, rs.statement, this, rs.speaker, rs.conversation, s);
     }
     return(baseValue);
 }
示例#5
0
 public bool IsStatHidden(RHStat stat)
 {
     if (!m_hiddenNumbers.ContainsKey(stat))
     {
         return(false);
     }
     return(m_hiddenNumbers[stat]);
 }
示例#6
0
    private Noun RHStatToNoun(RHStat s)
    {
        switch (s)
        {
        case RHStat.AUTHORITY:
            return(new NOUNAuthority());

        case RHStat.FAVOR:
            return(new NOUNFavorable());

        case RHStat.TRUST:
            return(new NOUNTrustable());

        default:
            return(new NOUNAuthority());
        }
    }
示例#7
0
    public virtual float GetBasePower(RHStat stateType)
    {
        switch (stateType)
        {
        case RHStat.AUTHORITY:
            return(m_baseAuthority);

        case RHStat.EMOTIONS:
            return(m_baseEmotions);

        case RHStat.FAVOR:
            return(m_baseFavor);

        case RHStat.TRUST:
            return(m_baseTrust);

        default:
            return(m_basePower);
        }
    }
示例#8
0
文件: RHManager.cs 项目: sdasd30/TSSG
 public static Sprite GetStatIcon(RHStat statType)
 {
     return(m_instance.m_RHStatIcons[(int)statType]);
 }
示例#9
0
 public virtual float OnStatementUsed(float baseValue, RHStatement statement, RHListener l, RHSpeaker speaker, RHConversation conversation, RHStat s = RHStat.CURRENT_PERSUASION_LEVEL)
 {
     return(baseValue);
 }
示例#10
0
    public virtual float GetPower(RHSpeaker speaker, RHListener listener, RHConversation c, RHStat stateType = RHStat.CURRENT_PERSUASION_LEVEL)
    {
        float             value   = 0;
        List <RHModifier> modList = new List <RHModifier>();

        switch (stateType)
        {
        case RHStat.AUTHORITY:
            modList = m_modAuthority;
            value   = m_baseAuthority;
            break;

        case RHStat.EMOTIONS:
            modList = m_modEmotions;
            value   = m_baseEmotions;
            break;

        case RHStat.FAVOR:
            modList = m_modFavor;
            value   = m_baseFavor;
            break;

        case RHStat.TRUST:
            modList = m_modTrust;
            value   = m_baseTrust;
            break;

        case RHStat.CURRENT_PERSUASION_LEVEL:
            modList = m_modPower;
            value   = m_basePower;
            break;
        }
        foreach (RHModifier m in modList)
        {
            value = m.ApplyModifier(value, c, listener);
        }
        return(value);
    }
示例#11
0
 public void SetHiddenStats(RHStat stat, bool hidden)
 {
     m_hiddenNumbers[stat] = hidden;
 }