예제 #1
0
    /// <summary>
    /// Logs a quest condition
    /// </summary>
    /// <param name="type">The type of quest condition that has been triggered</param>
    /// <param name="data">Some optional data describing the current occurence (e.g. name of enemy just defeated)</param>
    public void logQuestVariable(questTypes type, string data = "")
    {
        Debug.Log("Logged type " + type);
        Debug.Log("Data: " + data);
        var buffer = new List <QuestDef> (conditions.Keys);

        foreach (QuestDef def in buffer)
        {
            //Needs to invert option for the onlyOneCharacter quest type
            //If using the character specified, set string to "n/a" so that the quest condition is not changed.
            //If not using the character specified, then set to the empty string so that the quest condition is changed.
            if (def.Type == questTypes.onlyOneCharacter && type == questTypes.onlyOneCharacter)
            {
                if (def.Data == data)
                {
                    data = "n/a";
                }
                else
                {
                    data = "";
                }
            }
            if (def.Type == type && (def.Data == data || def.Data == ""))
            {
                if (isNegativeQuestCond(type))
                {
                    conditions [def] = false;
                }
                else
                {
                    conditions [def] = true;
                }
                Debug.Log("New Value: " + conditions [def]);
            }
        }
    }
예제 #2
0
 public QuestDef(string desc, questTypes type, string data = "")
 {
     this.pair = new KeyValuePair <questTypes, string> (type, data);
     this.desc = desc;
 }
예제 #3
0
 /// <summary>
 /// Returns the default value for all quest types
 /// </summary>
 /// <returns><c>true</c>, if default value is true, <c>false</c> otherwise.</returns>
 /// <param name="type">Type.</param>
 private bool questDefVal(questTypes type)
 {
     return(isNegativeQuestCond(type));
 }
예제 #4
0
 /// <summary>
 /// Determines whether a quest has a negative condition or not, meaning logging a variable means the quest has failed rather than passed
 /// </summary>
 /// <returns><c>true</c>, if negative condition., <c>false</c> otherwise.</returns>
 /// <param name="type">Type.</param>
 private bool isNegativeQuestCond(questTypes type)
 {
     return(negativeQuestConds.Contains(type));
 }