本文整理汇总了C#中TouchPoint.SetGesture方法的典型用法代码示例。如果您正苦于以下问题:C# TouchPoint.SetGesture方法的具体用法?C# TouchPoint.SetGesture怎么用?C# TouchPoint.SetGesture使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TouchPoint
的用法示例。
在下文中一共展示了TouchPoint.SetGesture方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update
public void Update()
{
if( mouseTouchEmulation )
{
Vector2 position = new Vector3( Input.mousePosition.x, Input.mousePosition.y );
// Ray extending from main camera into screen from touch point
Ray touchRay = Camera.main.ScreenPointToRay(position);
Debug.DrawRay(touchRay.origin, touchRay.direction * 10, Color.white);
TouchPoint touch = new TouchPoint(position, -1);
if( Input.GetMouseButtonDown(0) )
touch.SetGesture( EventBase.Type.Down );
else if( Input.GetMouseButtonUp(0) )
touch.SetGesture( EventBase.Type.Up );
else if( Input.GetMouseButton(0) )
touch.SetGesture( EventBase.Type.Move );
GameObject[] touchObjects = GameObject.FindGameObjectsWithTag("OmicronListener");
foreach (GameObject touchObj in touchObjects) {
touchObj.BroadcastMessage("OnTouch",touch,SendMessageOptions.DontRequireReceiver);
}
}
lock(eventList.SyncRoot)
{
foreach( EventData e in eventList )
{
if( (EventBase.ServiceType)e.serviceType == EventBase.ServiceType.ServiceTypePointer )
{
// 2D position of the touch, flipping y-coordinates
Vector2 position = new Vector3( e.posx * Screen.width, Screen.height - e.posy * Screen.height );
// Ray extending from main camera into screen from touch point
Ray touchRay = Camera.main.ScreenPointToRay(position);
Debug.DrawRay(touchRay.origin, touchRay.direction * 10, Color.white);
TouchPoint touch = new TouchPoint(position, (int)e.sourceId);
touch.SetGesture( (EventBase.Type)e.type );
GameObject[] touchObjects = GameObject.FindGameObjectsWithTag("OmicronListener");
foreach (GameObject touchObj in touchObjects) {
touchObj.BroadcastMessage("OnTouch",touch,SendMessageOptions.DontRequireReceiver);
}
}
else
{
GameObject[] omicronObjects = GameObject.FindGameObjectsWithTag("OmicronListener");
foreach (GameObject obj in omicronObjects) {
obj.BroadcastMessage("OnEvent",e,SendMessageOptions.DontRequireReceiver);
}
}
}
// Clear the list (TODO: probably should set the Processed flag instead and cleanup elsewhere)
eventList.Clear();
}
}
示例2: Update
public void Update()
{
if( mouseTouchEmulation )
{
Vector2 position = new Vector3( Input.mousePosition.x, Input.mousePosition.y );
// Ray extending from main camera into screen from touch point
Ray touchRay = Camera.main.ScreenPointToRay(position);
Debug.DrawRay(touchRay.origin, touchRay.direction * 10, Color.white);
TouchPoint touch = new TouchPoint(position, -1);
if( Input.GetMouseButtonDown(0) )
touch.SetGesture( EventBase.Type.Down );
else if( Input.GetMouseButtonUp(0) )
touch.SetGesture( EventBase.Type.Up );
else if( Input.GetMouseButton(0) )
touch.SetGesture( EventBase.Type.Move );
//GameObject[] touchObjects = GameObject.FindGameObjectsWithTag("OmicronListener");
//foreach (GameObject touchObj in touchObjects) {
// touchObj.BroadcastMessage("OnTouch",touch,SendMessageOptions.DontRequireReceiver);
//}
}
lock(eventList.SyncRoot)
{
foreach( EventData e in eventList )
{
ArrayList activeClients = new ArrayList();
foreach( OmicronEventClient c in omicronClients )
{
if( !c.IsFlaggedForRemoval() )
{
c.BroadcastMessage("OnEvent",e,SendMessageOptions.DontRequireReceiver);
activeClients.Add(c);
}
}
omicronClients = activeClients;
#if USING_GETREAL3D
if(getReal3D.Cluster.isMaster)
{
getReal3D.RpcManager.call ("AddStringEvent", OmicronConnectorClient.EventDataToString(e));
}
#endif
}
// Clear the list (TODO: probably should set the Processed flag instead and cleanup elsewhere)
eventList.Clear();
}
}