Exemple #1
0
    private IGestureAction CreateGestureAction(string name)
    {
        IGestureAction rv = null;

        if (sectionName == "demo")
        {
            if (name == "stand")
            {
                rv = new MoveCart(move);
            }
            if (name == "sit")
            {
                rv = new MoveCart(move);
            }
            if (name == "run")
            {
                rv = new RunMovement(move);
            }
            if (name == "swipeLeft")
            {
                rv = new MoveTrackLeft(move);
            }
            if (name == "swipeRight")
            {
                rv = new MoveTrackRight(move);
            }
            if (name == "raiseHands")
            {
                rv = new HandRaise();
            }
        }
        if (sectionName == "tutorial")
        {
            if (name == "standTutorial")
            {
                rv = new StandTutorial(tutor);
            }
            if (name == "sitTutorial")
            {
                rv = new SitTutorial(tutor);
            }
            if (name == "continueTutorial")
            {
                rv = new ContinueTutorial(tutor);
            }
            if (name == "")
            {
                rv = new SittingRunTutorial(tutor);
            }
        }

        return(rv);
    }
Exemple #2
0
    public void SetGesturesForSection(string sectionName)
    {
        gestureManager.Clear();
        List <string> gameActions = gestureManager.GetActionsForSection(sectionName);

        foreach (string gameAction in gameActions)
        {
            IGestureAction action = CreateGestureAction(gameAction);

            if (action != null)
            {
                gestureManager.AttachAction(sectionName, gameAction, action);
            }
        }
    }
    // Use this for initialization
    void Awake()
    {
        stand = new StandTutorial (tutor);
        sit = new SitTutorial (tutor);

        Debug.Log("Initializing Kinect");
        try
        {
            GameKinectSensor = new OhioState.Kinect.KinectSensor();
        }
        catch (Exception e)
        {
            Debug.LogError(e.Message);
        }

        currentKinectGameData = new KinectGameData();

        try
        {
            GameKinectSensor.SkeletonHandler += kinectSensor_SkeletonFrameReady;
            GameKinectSensor.Initialize();
        }
        catch (Exception e)
        {
            Debug.LogError(e.Message);
        }

        DontDestroyOnLoad(this.gameObject);
        int size = 5 * 60;
        gestureManager = new GestureManager(size, true);

        gestureManager.Level = 1;
        gestureManager.ReadFiles();
        //if (gestureManager.ErrorMessage.Length > 0)
        //    Debug.LogError(gestureManager.ErrorMessage);
        SetGesturesForSection("tutorial");
        Debug.Log("Kinect Complete");
    }