/// <summary> /// Simulate touching the character in TalkScene with mouse. /// </summary> /// <param name="talkScene">Talk scene</param> /// <param name="touchLocation">Where to touch</param> /// <param name="touchKind">How to touch</param> /// <param name="touchPosition">Optional position at which the touch happened (essentially mouse position)</param> public static void Touch(this TalkScene talkScene, TouchLocation touchLocation, TouchKind touchKind, Vector3 touchPosition = default) { var prevKind = talkScene.m_touchMode; talkScene.m_touchMode = (int)touchKind; talkScene.TouchFunc(touchLocation.ToString(), touchPosition); talkScene.m_touchMode = prevKind; }
/// <summary> /// Simulate touching the character in TalkScene with mouse. /// </summary> /// <param name="talkScene">Talk scene</param> /// <param name="touchLocation">Where to touch</param> /// <param name="touchKind">How to touch</param> /// <param name="touchPosition">Optional position at which the touch happened (essentially mouse position)</param> public static void Touch(this TalkScene talkScene, TouchLocation touchLocation, TouchKind touchKind, Vector3 touchPosition = default) { var tv = Traverse.Create(talkScene); var tmf = tv.Field <int>("m_touchMode"); var prevKind = tmf.Value; tmf.Value = (int)touchKind; tv.Method("TouchFunc", new[] { typeof(string), typeof(Vector3) }).GetValue(touchLocation.ToString(), touchPosition); tmf.Value = prevKind; }