本文整理汇总了C#中KinectGestures类的典型用法代码示例。如果您正苦于以下问题:C# KinectGestures类的具体用法?C# KinectGestures怎么用?C# KinectGestures使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
KinectGestures类属于命名空间,在下文中一共展示了KinectGestures类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GestureCompleted
public bool GestureCompleted(long userId, int userIndex, KinectGestures.Gestures gesture,
KinectInterop.JointType joint, Vector3 screenPos)
{
//string sGestureText = gesture + " detected";
//if(GestureInfo != null)
//{
// GestureInfo.guiText.text = sGestureText;
//}
if (gesture == KinectGestures.Gestures.Squat) {
int num = 0;
Camera.main.transform.SendMessage ("ActionPerformed",num);
}
else if (gesture == KinectGestures.Gestures.Jump) {
Camera.main.transform.SendMessage ("ActionPerformed",1);
}
else if (gesture == KinectGestures.Gestures.Wave) {
Camera.main.transform.SendMessage ("ActionPerformed",2);
}
else if (gesture == KinectGestures.Gestures.RaiseLeftHand) {
Camera.main.transform.SendMessage ("ActionPerformed",3);
}
else if (gesture == KinectGestures.Gestures.RaiseRightHand) {
Camera.main.transform.SendMessage ("ActionPerformed",4);
}
return true;
}
示例2: GestureInProgress
public void GestureInProgress(long userId, int userIndex, KinectGestures.Gestures gesture,
float progress, JointType joint, Vector3 screenPos)
{
//GestureInfo.guiText.text = string.Format("{0} Progress: {1:F1}%", gesture, (progress * 100));
// if(gesture == KinectGestures.Gestures.Click && progress > 0.3f)
// {
// string sGestureText = string.Format ("{0} {1:F1}% complete", gesture, progress * 100);
// if(GestureInfo != null)
// GestureInfo.guiText.text = sGestureText;
//
// progressDisplayed = true;
// }
// else
if((gesture == KinectGestures.Gestures.ZoomOut || gesture == KinectGestures.Gestures.ZoomIn) && progress > 0.5f)
{
string sGestureText = string.Format ("{0} detected, zoom={1:F1}%", gesture, screenPos.z * 100);
if(GestureInfo != null)
GestureInfo.guiText.text = sGestureText;
progressDisplayed = true;
}
else if(gesture == KinectGestures.Gestures.Wheel && progress > 0.5f)
{
string sGestureText = string.Format ("{0} detected, angle={1:F1} deg", gesture, screenPos.z);
if(GestureInfo != null)
GestureInfo.guiText.text = sGestureText;
progressDisplayed = true;
}
}
示例3: GestureInProgress
public void GestureInProgress(long userId, int userIndex, KinectGestures.Gestures gesture,
float progress, KinectInterop.JointType joint, Vector3 screenPos)
{
// the gestures are allowed for the primary user only
KinectManager manager = KinectManager.Instance;
if(!manager || (userId != manager.GetPrimaryUserID()))
return;
// this function is currently needed only to display gesture progress, skip it otherwise
if(gestureInfo == null)
return;
if((gesture == KinectGestures.Gestures.ZoomOut || gesture == KinectGestures.Gestures.ZoomIn) && progress > 0.5f)
{
string sGestureText = string.Format ("{0} {1:F0}%", gesture, screenPos.z * 100f);
gestureInfo.GetComponent<GUIText>().text = sGestureText;
progressDisplayed = true;
progressGestureTime = Time.realtimeSinceStartup;
}
else if(gesture == KinectGestures.Gestures.Wheel && progress > 0.5f)
{
string sGestureText = string.Format ("{0} {1:F0} degrees", gesture, screenPos.z);
gestureInfo.GetComponent<GUIText>().text = sGestureText;
//Debug.Log(sGestureText);
progressDisplayed = true;
progressGestureTime = Time.realtimeSinceStartup;
}
}
示例4: GestureCompleted
public bool GestureCompleted(uint userId, int userIndex, KinectGestures.Gestures gesture,
KinectWrapper.NuiSkeletonPositionIndex joint, Vector3 screenPos)
{
string sGestureText = gesture + " detected";
if(GestureInfo != null)
{
GestureInfo.guiText.text = sGestureText;
}
if(gesture == KinectGestures.Gestures.SwipeLeft)
{
swipeLeft = true;
}
if(gesture == KinectGestures.Gestures.SwipeRight)
{
swipeRight = true;
}
if(gesture == KinectGestures.Gestures.SwipeUp)
{
swipeUp = true;
}
if(gesture == KinectGestures.Gestures.SwipeDown)
{
swipeDown = true;
}
if(gesture == KinectGestures.Gestures.Push)
{
push = true;
}
if(gesture == KinectGestures.Gestures.Pull)
{
pull = true;
}
return true;
}
示例5: GestureCompleted
public bool GestureCompleted(uint userId, int userIndex, KinectGestures.Gestures gesture,
KinectWrapper.NuiSkeletonPositionIndex joint, Vector3 screenPos)
{
string sGestureText = gesture + " detected";
if (gesture == KinectGestures.Gestures.Click) {
sGestureText += string.Format (" at ({0:F1}, {1:F1})", screenPos.x, screenPos.y);
print ("CLICKED DOWN???!?!?!?!?!"); //reverse units
print ("SCREEN POS: " + screenPos);
clickedPos.x = screenPos.x;
clickedPos.y = screenPos.y;
GetComponent<LineGame> ().kinectClickedOn = true;
GetComponent<LineGame> ().clickedPos = clickedPos;
GetComponent<Main> ().kinectClickedOn = true;
GetComponent<Main> ().clickedPos = clickedPos;
GetComponent<GrowingTeamGame> ().kinectClickedOn = true;
GetComponent<GrowingTeamGame> ().clickedPos = clickedPos;
GetComponent<AquariumGame> ().kinectClickedOn = true;
GetComponent<AquariumGame> ().clickedPos = clickedPos;
}
if(GestureInfo != null)
GestureInfo.GetComponent<GUIText>().text = sGestureText;
progressDisplayed = false;
return true;
}
示例6: GestureInProgress
public void GestureInProgress(uint userId, int userIndex, KinectGestures.Gestures gesture,
float progress, KinectWrapper.NuiSkeletonPositionIndex joint, Vector3 screenPos)
{
//GestureInfo.guiText.text = string.Format("{0} Progress: {1:F1}%", gesture, (progress * 100));
if(gesture == KinectGestures.Gestures.Click && progress > 0.3f)
{
string sGestureText = string.Format ("{0} {1:F1}% complete", gesture, progress * 100);
if(GestureInfo != null)
GestureInfo.GetComponent<GUIText>().text = sGestureText;
progressDisplayed = true;
}
else if((gesture == KinectGestures.Gestures.ZoomOut || gesture == KinectGestures.Gestures.ZoomIn) && progress > 0.5f)
{
string sGestureText = string.Format ("{0} detected, zoom={1:F1}%", gesture, screenPos.z * 100);
if(GestureInfo != null)
GestureInfo.GetComponent<GUIText>().text = sGestureText;
progressDisplayed = true;
}
else if(gesture == KinectGestures.Gestures.Wheel && progress > 0.5f)
{
string sGestureText = string.Format ("{0} detected, angle={1:F1} deg", gesture, screenPos.z);
if(GestureInfo != null)
GestureInfo.GetComponent<GUIText>().text = sGestureText;
progressDisplayed = true;
}
}
示例7: GestureCompleted
//Virtual override of KinectGestures.GestureListenerInterface.GestureCompleted
//Once completed a gesture propogate the gesture to the GestureNavigationMenu
public bool GestureCompleted(long userId, int userIndex, KinectGestures.Gestures gesture,
KinectInterop.JointType joint, Vector3 screenPos)
{
string sGestureText = gesture + " detected";
if(GestureInfo != null)
{
GestureInfo.text = sGestureText;
}
//depending on which gesture is performed, call the relevant function in the GestureNavigationMenu
switch (gesture) {
case KinectGestures.Gestures.SwipeUp:
menu.SwipeUp();
break;
case KinectGestures.Gestures.SwipeDown:
menu.SwipeDown();
break;
case KinectGestures.Gestures.SwipeLeft:
menu.SwipeLeft();
break;
case KinectGestures.Gestures.SwipeRight:
menu.SwipeRight();
break;
default:
break;
}
progressDisplayed = false;
return true;
}
示例8: GestureCancelled
/// <summary>
/// Invoked if a gesture is cancelled.
/// </summary>
/// <returns>true</returns>
/// <c>false</c>
/// <param name="userId">User ID</param>
/// <param name="userIndex">User index</param>
/// <param name="gesture">Gesture type</param>
/// <param name="joint">Joint type</param>
public bool GestureCancelled(long userId, int userIndex, KinectGestures.Gestures gesture,
KinectInterop.JointType joint)
{
// the gestures are allowed for the primary user only
KinectManager manager = KinectManager.Instance;
if(!manager || (userId != manager.GetPrimaryUserID()))
return false;
if(gesture == KinectGestures.Gestures.LeanLeft)
{
leanLeft = false;
}
else if(gesture == KinectGestures.Gestures.LeanRight)
{
leanRight = false;
}
else if(gesture == KinectGestures.Gestures.Wheel)
{
wheel = false;
}
if(gestureInfo != null && progressDisplayed)
{
progressDisplayed = false;
gestureInfo.GetComponent<GUIText>().text = "Lean-left, Lean-right to rotate the Room.";
}
return true;
}
示例9: GestureCompleted
public bool GestureCompleted(uint userId, int userIndex, KinectGestures.Gestures gesture,
KinectWrapper.NuiSkeletonPositionIndex joint, Vector3 screenPos)
{
if (gesture == KinectGestures.Gestures.SwipeLeft && Cart.scene2) {
Debug.Log("Swipe Left Completed!");
GameObject.FindObjectOfType<Shelf>().SwipeLeft();
}
if (gesture == KinectGestures.Gestures.SwipeRight && Cart.scene2) {
//Debug.Log("Swipe Left Completed!");
GameObject.FindObjectOfType<Cart>().SwipeRight();
Debug.Log("Swipe Right Completed!");
}
string sGestureText = gesture + " detected";
if(gesture == KinectGestures.Gestures.Click)
sGestureText += string.Format(" at ({0:F1}, {1:F1})", screenPos.x, screenPos.y);
if(GestureInfo != null)
GestureInfo.GetComponent<GUIText>().text = sGestureText;
progressDisplayed = false;
return true;
}
示例10: GestureCompleted
public bool GestureCompleted(uint userId, int userIndex, KinectGestures.Gestures gesture,
KinectWrapper.SkeletonJoint joint, Vector3 screenPos)
{
KinectManager manager = KinectManager.Instance;
string sGestureText = gesture + " detected";
if(GestureInfo != null)
{
GestureInfo.guiText.text = sGestureText;
}
if (gesture == KinectGestures.Gestures.SwipeLeft)
swipeLeft = true;
else if (gesture == KinectGestures.Gestures.SwipeRight)
swipeRight = true;
//else if(gesture == KinectGestures.Gestures.RaiseLeftHand)
// RaiseLeftHand = true;
//else if(gesture == KinectGestures.Gestures.RaiseRightHand)
// RaiseRightHand = true;
else if (gesture == KinectGestures.Gestures.Push)
Push = true;
else if (gesture == KinectGestures.Gestures.Psi)
PSI = true;
else if (gesture == KinectGestures.Gestures.Wave)
Wave = true;
return true;
}
示例11: GestureInProgress
public void GestureInProgress(long userId, int userIndex, KinectGestures.Gestures gesture,
float progress, KinectInterop.JointType joint, Vector3 screenPos)
{
/*if((gesture == KinectGestures.Gestures.ZoomOut || gesture == KinectGestures.Gestures.ZoomIn) && progress > 0.5f)
{
string sGestureText = string.Format ("{0} detected, zoom={1:F1}%", gesture, screenPos.z * 100);
if(GestureInfo != null)
{
GestureInfo.text = sGestureText;
}
//Debug.Log(sGestureText);
progressDisplayed = true;
}
else if(gesture == KinectGestures.Gestures.Wheel && progress > 0.5f)
{
string sGestureText = string.Format ("{0} detected, angle={1:F1} deg", gesture, screenPos.z);
if(GestureInfo != null)
{
GestureInfo.text = sGestureText;
}
//Debug.Log(sGestureText);
progressDisplayed = true;
}*/
}
示例12: GestureInProgress
public void GestureInProgress(long userId, int userIndex, KinectGestures.Gestures gesture,
float progress, KinectInterop.JointType joint, Vector3 screenPos)
{
if((gesture == KinectGestures.Gestures.ZoomOut || gesture == KinectGestures.Gestures.ZoomIn) && progress > 0.5f)
{
string sGestureText = string.Format ("{0} {1:F0}%", gesture, screenPos.z * 100f);
if(GestureInfo != null)
{
GestureInfo.GetComponent<GUIText>().text = sGestureText;
}
progressDisplayed = true;
progressGestureTime = Time.realtimeSinceStartup;
}
else if(gesture == KinectGestures.Gestures.Wheel && progress > 0.5f)
{
string sGestureText = string.Format ("{0} {1:F0} deg.", gesture, screenPos.z);
if(GestureInfo != null)
{
GestureInfo.GetComponent<GUIText>().text = sGestureText;
}
//Debug.Log(sGestureText);
progressDisplayed = true;
progressGestureTime = Time.realtimeSinceStartup;
}
}
示例13: GestureInProgress
public void GestureInProgress(long userId, int userIndex, KinectGestures.Gestures gesture,
float progress, KinectInterop.JointType joint, Vector3 screenPos)
{
// the gestures are allowed for the primary user only
KinectManager manager = KinectManager.Instance;
if(!manager || (userId != manager.GetPrimaryUserID()))
return;
if((gesture == KinectGestures.Gestures.ZoomOut || gesture == KinectGestures.Gestures.ZoomIn) && progress > 0.5f)
{
string sGestureText = string.Format ("{0} detected, zoom={1:F1}%", gesture, screenPos.z * 100);
if(GestureInfo != null)
{
GestureInfo.GetComponent<GUIText>().text = sGestureText;
}
//Debug.Log(sGestureText);
progressDisplayed = true;
}
else if(gesture == KinectGestures.Gestures.Wheel && progress > 0.5f)
{
string sGestureText = string.Format ("{0} detected, angle={1:F1} deg", gesture, screenPos.z);
if(GestureInfo != null)
{
GestureInfo.GetComponent<GUIText>().text = sGestureText;
}
//Debug.Log(sGestureText);
progressDisplayed = true;
}
}
示例14: GestureCompleted
//KinectGestures.GestureListenerInterface virtual implementation
public bool GestureCompleted(long userId, int userIndex, KinectGestures.Gestures gesture,
KinectInterop.JointType joint, Vector3 screenPos)
{
string sGestureText = gesture + " detected";
//Propogate the recognised gesture to the cursor controller
if(cursor!=null)cursor.WaveRecognised();
if(cursorDirect!=null)cursorDirect.WaveRecognised();
return true;
}
示例15: GestureCompleted
public bool GestureCompleted(long userId, int userIndex, KinectGestures.Gestures gesture,
KinectInterop.JointType joint, Vector3 screenPos)
{
if (activeGestures.ContainsKey(userId))
activeGestures[userId].Enqueue(gesture);
return true;
// this true return will clear the gesture info, because once we've completed one gesture,
// we assume that any others started at the same time were actually just misinterpretations.
}