コード例 #1
0
 private void ExecuteConditionScript(string [] tokens)
 {
     if (GameManager.Inst.QuestManager.StoryConditions.ContainsKey(tokens[1]))
     {
         StoryCondition condition = GameManager.Inst.QuestManager.StoryConditions[tokens[1]];
         if (tokens[2] == "true")
         {
             condition.SetValue(1);
         }
         else if (tokens[2] == "false")
         {
             condition.SetValue(0);
         }
         else if (tokens[2] == "toggle")
         {
             if (condition.GetValue() == 1)
             {
                 condition.SetValue(0);
             }
             else
             {
                 condition.SetValue(1);
             }
         }
         else if (tokens[2] == "activate")
         {
             condition.IsActive = true;
         }
         else if (tokens[2] == "deactivate")
         {
             condition.IsActive = false;
         }
         else
         {
             condition.SetValue(Convert.ToInt32(tokens[2]));
             //Debug.Log("setting condition " + condition.ID + " to " + condition.GetValue());
         }
     }
 }