void Start() { // get the stream component from PlStream.cs plstream = GameObject.Find("Polhemus").GetComponent <PlStream>(); // get players players = GameObject.FindGameObjectsWithTag("Player"); dropped = new int[players.Length]; PlayerPrefs.SetInt("trialNumber", 0); }
// Use this for initialization void Awake() { // get the stream component from PlStream.cs plstream = GameObject.Find("Polhemus").GetComponent <PlStream>(); // get players //players = GameObject.FindGameObjectsWithTag("Player"); players = GameObject.FindGameObjectsWithTag("Player"); dropped = new int[players.Length]; }
// Use this for initialization void Awake() { // set divisor defaults divisor_slider.value = 1.0f; // set sensors defaults sensors_slider.value = 1; // get the stream component plstream = GetComponent <PlStream>(); // get knuckles knuckles = GameObject.FindGameObjectsWithTag("Knuckle"); dropped = new int[knuckles.Length]; // set sensors_slider max value sensors_slider.maxValue = Mathf.Min(knuckles.Length, plstream.active.Length); }
// Use this for initialization void Awake() { Instance = this; try { // there are some constraints between tracking systems switch (tracker_type) { case PlTracker.Liberty: // liberty is a single tracker system max_systems = (max_systems > 1) ? 1 : max_systems; max_sensors = (max_sensors > 16) ? 16 : max_sensors; break; case PlTracker.Patriot: max_systems = (max_systems > 1) ? 1 : max_systems; max_sensors = (max_sensors > 2) ? 2 : max_sensors; break; case PlTracker.G4: // all G4 hubs (systems) have a maximum of 3 sensors max_sensors = (max_sensors > 3) ? 3 : max_sensors; break; case PlTracker.Fastrak: max_systems = (max_systems > 1) ? 1 : max_systems; max_sensors = (max_sensors > 4) ? 4 : max_sensors; break; default: throw new Exception("[polhemus] Unknown Tracker selected in PlStream::Awake()."); } // set the number of slots max_slots = max_sensors * max_systems; // allocate resources for those slots active = new bool[max_slots]; digio = new uint[max_slots]; positions = new Vector3[max_slots]; orientations = new Vector4[max_slots]; // initialize the slots for (int i = 0; i < max_slots; ++i) { active[i] = false; digio[i] = 0; positions[i] = Vector3.zero; orientations[i] = Vector4.zero; } switch (tracker_type) { case PlTracker.Liberty: case PlTracker.Patriot: conThread = new Thread(new ThreadStart(read_liberty)); break; case PlTracker.G4: conThread = new Thread(new ThreadStart(read_g4)); break; case PlTracker.Fastrak: conThread = new Thread(new ThreadStart(read_fastrak)); break; default: throw new Exception("[polhemus] Unknown Tracker selected in PlStream::Awake()."); } // start the read thread conThread.Start(); } catch (Exception e) { Debug.Log(e); Debug.Log("[polhemus] PlStream terminated in PlStream::Awake()."); Console.WriteLine("[polhemus] PlStream terminated in PlStream::Awake()."); } }
void Awake() { // get the stream component from PlStream.cs plstream = GameObject.Find("Polhemus").GetComponent <PlStream>(); }
// Use this for initialization void Start() { plStream = GetComponent <PlStream>(); }