C#字典 - Unity / Kinect项目中Enum键的访问值

时间:2016-07-13 09:56:41

标签: dictionary unity3d enums kinect face

我正在尝试访问

RootSystem.Collections.Generic.Dictionary<Microsoft.Kinect.Face.FaceProperty, Windows.Kinect.DetectionResult> FaceProperties

在Unity中使用Kinect插件。

因此,FaceProperty和DetectionResult是枚举:

public enum FaceProperty : int
{
    Happy                                    =0,
    Engaged                                  =1,
    WearingGlasses                           =2,
    LeftEyeClosed                            =3,
    RightEyeClosed                           =4,
    MouthOpen                                =5,
    MouthMoved                               =6,
    LookingAway                              =7,
}

public enum DetectionResult : int
{
    Unknown                                  =0,
    No                                       =1,
    Maybe                                    =2,
    Yes                                      =3,
}

然后在调试模式下,我试图访问FaceProperties:

FaceProperties                        // Count = 8
FaceProperties[0]                     // Incorrect types or number of arguments
FaceProperties[FaceProperty.Happy]    // The name 'FaceProperties[global::Microsoft.Kinect.Face.FaceProperty.Happy]' 
                                      // does not exist in the current context. 

你有什么想法我怎么可能访问字典FaceProperties的值?

提前致谢, bertiooo

1 个答案:

答案 0 :(得分:0)

您可能缺少命名空间:

using Microsoft.Kinect.Face;