protected void SwitchItem(DialogTopic.Item item) { CurrentHandler?.End(); if (item == null) { Debug.LogError("Unable to handle dialog topic item NULL", CurrentState); Manager.Exit(); } else { CurrentHandler = ItemHandler.PickHandler(item); if (CurrentHandler != null) { CurrentHandler.Begin(this); } else { Debug.LogError(string.Format("Unable to handle dialog topic item {0}", item), CurrentState); Manager.Exit(); } } }
public static ItemHandler PickHandler(DialogTopic.Item item) { return(HandlerFactory[item.GetType()](item)); }