using NUnit.Framework.Internal; using OpenCVForUnity.CoreModule; using OpenCVForUnity.DnnModule; using OpenCVForUnity.UnityUtils; using OpenCVForUnity.UnityUtils.Helper; using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Linq; using UnityEngine; public class YogaManager : MonoSingleton { private List _points = new List(); public List Points { get => _points; private set => _points = value; } private int _currentActionCount; //当前动作计数 public int CurrentActionCount { get => _currentActionCount; internal set => _currentActionCount = value; } private int _currentSuccessActionCount; //当前成功动作计数 public int CurrentSuccessActionCount { get => _currentSuccessActionCount; internal set => _currentSuccessActionCount = value; } private int _actionIndex; //用户选择界面选择的动作索引 public int ActionIndex { get => _actionIndex; internal set => _actionIndex = value; } private Dictionary _actions = new Dictionary(); public void InitData() { _actions[AvatarAction.HeadTurnLeft] = new HeadTurnLeft(); _actions[AvatarAction.HeadTurnRight] = new HeadTurnRight(); _currentActionCount = 0; _currentSuccessActionCount = 0; } public bool IsCorrectAction(List personPoints, AvatarAction actionType) { if (!_actions.ContainsKey(actionType)) { Debug.LogError("ActionType is not exist"); return false; } var result = _actions[actionType].CheckPose(personPoints); Debug.LogWarning("ActionType: " + actionType + " result: " + result); return result; } }