Пример #1
0
	// Player Responded, set the next topic
	public void ChooseOption( ConversationOption option )
	{
		TopicName next_topic_name = option._nextTopic;

		// Special Handling for END
		if ( next_topic_name == TopicName.END )
		{
			option.OnOptionChosen();

			// End Topic
			OnConversationEnd();
			_state = null;
			return;
		}

		// don't do anything, just a warning, if the topic they chose doesn't exist as a valid option
		bool found = false;
		foreach ( ConversationOption curr_option in _state._currentTopic._options )
		{
			if ( curr_option == option )
			{
				found = true;
				break;
			}
		}

		if ( ! found )
		{
			Debug.LogError("TOPIC IS NOT A VALID OPTION: " + next_topic_name);
			return;
		}

		// Make sure there is a mapping to this topic name in our topics collection
		Topic next_topic = null;

		foreach ( Topic topic in _state._topics )
		{
			if ( topic._topicName == next_topic_name )
			{
				next_topic = topic;
				break;
			}
		}

		if ( next_topic == null )
		{
			Debug.LogError("FAILED TO FIND FIND TOPIC IN TOPIC NAME: " + next_topic_name );
			return;
		}

		// Trigger Event
		option.OnOptionChosen();

		// Update State
		_state._currentTopicName = next_topic_name;
		_state._currentTopic = next_topic;

		_topicChanged.Invoke();
	} 
Пример #2
0
	public void OnTopicButtonChosen( ConversationOption option )
	{
		// Tell the Conversation Player it's time to change
		_convoPlayer.ChooseOption( option );
	}