Example #1
0
    public void initialize(ZgManager aZig)
    {
        var mZigObject = ManagerManager.Manager.gameObject;

        //mZigObject.AddComponent<kinectSpecific>();
        mZig = mZigObject.GetComponent <Zig>();

        //TODO try this again...

        /*
         * mZig = mZigObject.AddComponent<Zig>();
         * mZig.inputType = ZigInputType.Auto;
         * mZig.settings.UpdateDepth = true;
         * mZig.settings.UpdateImage = true;
         * mZig.settings.AlignDepthToRGB = false;
         * mZig.settings.OpenNISpecific.Mirror = true;
         * mZigObject.AddComponent<ZigEngageSingleUser>();
         */


        //ZigEngageSingleUser scans for all users but only reports results from one of them (the first I guess)
        //normally this is set in editor initializers but we don't do that here
        mZigEngageSingleUser = mZigObject.GetComponent <ZigEngageSingleUser>();
        mZigEngageSingleUser.EngagedUsers = new System.Collections.Generic.List <UnityEngine.GameObject>();
        mZigEngageSingleUser.EngagedUsers.Add(mZigObject);

        //this is the only way to get callbacks from ZigEngageSingleUser
        mZigCallbackBehaviour = mZigObject.AddComponent <ZigCallbackBehaviour>();
        mZigCallbackBehaviour.mUpdateUserDelegate  += Zig_UpdateUser;
        mZigCallbackBehaviour.mUpdateInputDelegate += Zig_UpdateInput;
    }
 // Use this for initialization
 void Start()
 {
     sampler = new JointSampler ();
     user_id = PlayerPrefs.GetInt ("ActiveUser", 1);
     // Load ZigFu game object.  This game object has 4 Zig related script Components.  Use this object
     // to instances of these script's classes in order to access event information :)
     zigfu = GameObject.Find ("ZigFu");
     zig_control = zigfu.GetComponent <Zig>();
     skeleton = GetComponent <ZigSkeleton>();
     db_control = new dbAccess ();
     reader = new GloveReader ();
 }
    // Use this for initialization
    void Start()
    {
        // Instantiate objects
        // Load ZigFu game object.  This game object has 4 Zig related script Components.  Use this object
        // to instances of these script's classes in order to access event information :)
        zigfu = GameObject.Find ("ZigFu");
        sampler = new JointSampler ();
        zig_control = zigfu.GetComponent <Zig>();
        // This script is attached to Carl so GetComponent can be called directly
        skeleton = GetComponent <ZigSkeleton>();

        l_shoulder_angles = new Vector3();
        r_shoulder_angles = new Vector3();

        db_control = new dbAccess ();
        user_id = PlayerPrefs.GetInt ("ActiveUser", 1);
        // DEBUG: Access some application run-time data.  Compare this output to where the scene was loaded from
        //Debug.Log ("isEditor: " + Application.isEditor + "\nisLoadinglevel: " + Application.isLoadingLevel + "\nLoadedLevelName: " + Application.loadedLevelName +
        //           "\nplatform: " + Application.platform + "\nGenuine: " + Application.genuine + "\ngenuineCheckAvailable: " + Application.genuineCheckAvailable +
        //           "\nbackgroundLoadingPriority: " + Application.backgroundLoadingPriority);

        // Calculate max and min y-axis rotations to allow abduction measurements
        max_y_rotation = degrees_freedom;
        min_y_rotation = -degrees_freedom;

        // Get zig joint identification numbers for each shoulder
        R_shoulder_id = ZigJointId.RightShoulder;
        L_shoulder_id = ZigJointId.LeftShoulder;

        currentExercise = 0;
        exercise = "Press Next To Start";
        style = new GUIStyle();
        instructions = " ";
        time_hold = 0;
        inPosition = true;
    }