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)); }
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); } }
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); }
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); }
public bool IsStatHidden(RHStat stat) { if (!m_hiddenNumbers.ContainsKey(stat)) { return(false); } return(m_hiddenNumbers[stat]); }
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()); } }
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); } }
public static Sprite GetStatIcon(RHStat statType) { return(m_instance.m_RHStatIcons[(int)statType]); }
public virtual float OnStatementUsed(float baseValue, RHStatement statement, RHListener l, RHSpeaker speaker, RHConversation conversation, RHStat s = RHStat.CURRENT_PERSUASION_LEVEL) { return(baseValue); }
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); }
public void SetHiddenStats(RHStat stat, bool hidden) { m_hiddenNumbers[stat] = hidden; }