示例#1
0
    public string MeetsRequirements(RHStatement statement, RHSpeaker speaker)
    {
        if (m_permittedStatements.Count > 0)
        {
            bool found = false;
            foreach (RHStatement s in m_bannedStatements)
            {
                if (s.StatementName == statement.StatementName)
                {
                    found = true;
                }
            }
            if (!found)
            {
                return("Not permitted for this conversation");
            }
        }
        if (m_bannedStatements.Count > 0)
        {
            foreach (RHStatement s in m_bannedStatements)
            {
                if (s.StatementName == statement.StatementName)
                {
                    return("Not permitted for this conversation");
                }
            }
        }

        return(statement.MeetsRequirements(speaker, this));
    }
示例#2
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));
    }
示例#3
0
 private void ProcessHistoryText(RHStatement st, RHSpeaker speaker, RHListener listener, float diff)
 {
     foreach (RHResponseString s in m_registeredResponses)
     {
         if (s.IsConditionTrue(st, m_previousStatements, speaker, listener, diff, m_startingSpeaker))
         {
             RHManager.AddHistoryText(s);
         }
     }
 }
示例#4
0
    private int GetNumberOfOccurances(RHStatement baseStatement)
    {
        int i = 0;

        foreach (RHStatement s in m_previousStatements)
        {
            if (s.StatementName == baseStatement.StatementName)
            {
                i++;
            }
        }
        return(i);
    }
示例#5
0
    public override void TriggerEvent(AIEvent aie)
    {
        AIEVStatementReceived aiev = aie as AIEVStatementReceived;

        if (aiev == null)
        {
            return;
        }
        RHStatement newStatement = aiev.statement.GenerateStandardResponse(aiev.speaker, MasterAI.GetComponent <RHListener>());

        if (newStatement != null)
        {
            aiev.conversation.QueueStatement(newStatement, MasterAI.GetComponent <RHSpeaker>());
        }
        //RHStatement statementReceived = aiev.statement;
        //RHStatement response = statementReceived.GenerateResponse( MasterAI.GetComponent<RHListener>());

        //aiev.conversation.QueueStatement(response, MasterAI.GetComponent<RHSpeaker>());
    }
示例#6
0
    public void QueueStatement(RHStatement statement, RHSpeaker speaker, bool stack = false)
    {
        if (!m_battleStarted)
        {
            startActiveBattle();
        }

        statement.OnStatementQueued(speaker);
        RHRegisteredStatement rs = new RHRegisteredStatement(statement, speaker, this);

        m_queue.RegisterStatement(rs);
        bool clickable = speaker == m_startingSpeaker && ((statement as RHSDeadAir) == null);

        m_timeUI.AddItem(rs, m_speakerColorMaps[speaker], m_queue.CalculateQueuedStatementExecutionTime(rs, m_nextStatementEnd), stack, clickable);
        if (!m_battleStarted)
        {
            advanceStatements();
        }
        m_battleStarted = true;
    }
示例#7
0
文件: RHManager.cs 项目: sdasd30/TSSG
    private static DialogueOptionInitializer convertToDialogueOption(RHStatement s, List <RHStatement> allStatements, RHSpeaker speaker, RHConversation baseConversation)
    {
        DialogueOptionInitializer doi = new DialogueOptionInitializer();

        void SelectionFunction(DialogueOption selectedOption)
        {
            baseConversation.QueueStatement(s, baseConversation.Speakers[0]);
            RHManager.CreateDialogueOptionList(allStatements, speaker, baseConversation, "Select your next Statement", FindObjectOfType <DialogueOptionBox>().GetScrollValue());
        }

        string name = s.StatementName;

        if (name == null || name == "")
        {
            name = s.gameObject.name;
        }
        doi.SelectionText = name;

        doi.OnSelect = SelectionFunction;

        doi.CloseDialogueWindow = true;

        s.AddIcons(doi, speaker, baseConversation);
        string missingRequirements = baseConversation.MeetsRequirements(s, speaker);

        doi.Interactable = (missingRequirements == "Meets Requirements");
        doi.hoverText    = (doi.Interactable) ? s.GetHoverText(baseConversation) : missingRequirements;
        //string timeStr = s.Time.ToString("F2") + " s";
        //doi.AddTextIcon(timeStr, Color.white);

        //foreach (RHListener l in baseConversation.Listeners.Keys)
        //{
        //    if (l == speaker.GetComponent<RHListener>())
        //        continue;v
        //    float f = s.GetPower(baseConversation.Speakers[0], l, baseConversation);
        //    Color c = proportionToColor(s.BasePower, f);
        //    doi.AddTextIcon(f.ToString("F2"), c);
        //    doi.Interactable = s.IsEnabled(baseConversation.Speakers[0],baseConversation);
        //}
        return(doi);
    }
示例#8
0
    public bool IsConditionTrue(RHStatement st, List <RHStatement> previousStatements, RHSpeaker s, RHListener l, float diff, RHSpeaker playerSpeaker)
    {
        if (m_statementName.Length > 0 && st.StatementName.ToLower() != m_statementName.ToLower())
        {
            return(false);
        }
        RHStatement last = previousStatements[previousStatements.Count - 1];

        if (m_previousStatement.Length > 0 && last.StatementName.ToLower() != m_previousStatement.ToLower())
        {
            return(false);
        }

        if (m_isPlayerListener && l.GetComponent <RHSpeaker>() != playerSpeaker)
        {
            return(false);
        }
        else if (m_speaker != null && m_speaker != s)
        {
            return(false);
        }

        if (m_isPlayerSpeaker && s != playerSpeaker)
        {
            return(false);
        }
        else if (m_listener != null && m_listener != l)
        {
            return(false);
        }

        if (diff < m_powerRequirement)
        {
            return(false);
        }
        return(true);
    }
示例#9
0
 public RHRegisteredStatement(RHStatement statement, RHSpeaker speaker, RHConversation conversation)
 {
     this.statement    = statement;
     this.speaker      = speaker;
     this.conversation = conversation;
 }
示例#10
0
 public virtual float OnGetAttribute(float baseValue, RHStatement statement, RHListener l, RHSpeaker speaker, RHConversation conversation)
 {
     return(baseValue);
 }
示例#11
0
 public virtual float OnStatementUsed(float baseValue, RHStatement statement, RHListener l, RHSpeaker speaker, RHConversation conversation, RHStat s = RHStat.CURRENT_PERSUASION_LEVEL)
 {
     return(baseValue);
 }
示例#12
0
    public virtual RHStatement GenerateResponse(RHListener l)
    {
        RHStatement st = GetEmptyGenerateResourcesStatement();

        return(st);
    }
示例#13
0
 public virtual RHResponseString GetResponseString(RHStatement statement, RHSpeaker speaker, Dictionary <RHStat, float> results)
 {
     return(null);
 }
示例#14
0
文件: AIEvent.cs 项目: sdasd30/TSSG
 public AIEVStatementReceived(RHConversation c, RHStatement statement, RHSpeaker speaker)
 {
     conversation   = c;
     this.speaker   = speaker;
     this.statement = statement;
 }