/// <summary> /// Handles the startup /// </summary> private void Start() { if (Application.isPlaying) { if (trackerButtonList == null) { trackerButtonList = this.GetComponent <TrackerButtonList>(); } if (trackerButtonList == null) { this.gameObject.AddComponent(typeof(TrackerButtonList)); trackerButtonList = this.GetComponent <TrackerButtonList>(); } //Add a toolManager to the wandObject to shuffle between tools toolManager = new ToolManager(wandObject, this.gameObject, TopLevelUniCAVE, deadZone, rotationSpeed, movementSpeed, tool, negativeAnalogX, negativeAnalogY); //add state of each button foreach (TrackerButton btn in Enum.GetValues(typeof(TrackerButton))) { buttonState.Add(btn, false); } //Start the coroutines if (trackButton) { StartCoroutine("Button"); } if (trackAnalog) { StartCoroutine("Analog"); } } }
/// <summary> /// Handles the startup /// </summary> private void Start() { if (Application.isPlaying) { if (trackerButtonList == null) { trackerButtonList = this.GetComponent <TrackerButtonList>(); } if (trackerButtonList == null) { this.gameObject.AddComponent(typeof(TrackerButtonList)); trackerButtonList = this.GetComponent <TrackerButtonList>(); } //Add a toolManager to the wandObject to shuffle between tools toolManager = new ToolManager(wandObject, this.gameObject, TopLevelUniCAVE, deadZone, rotationSpeed, movementSpeed, tool, negativeAnalogX, negativeAnalogY); //add state of each button foreach (TrackerButton btn in Enum.GetValues(typeof(TrackerButton))) { buttonState.Add(btn, false); } //this gets rid of this object from non-head nodes...we only want this running on the machine that connects to VRPN... //this assumes a distributed type setup, where one machine connects to the tracking system and distributes information //to other machines... //some setups may try to connect each machine to vrpn... //in that case, we wouldn't want to destroy this object.. //if (Util.GetMachineName() != master.masterMachineName) { // Debug.Log("Removing tracker settings from " + Util.GetMachineName()); // Destroy(this); // return; //} if (!isServer) { Destroy(this); return; } #if !UNITY_EDITOR //Start the coroutines if (trackButton) { StartCoroutine("Button"); } if (trackAnalog) { StartCoroutine("Analog"); } #endif } }
/// <summary> /// Handles the enabling of the editor. Gets the list currently. /// </summary> void OnEnable() { t = (TrackerButtonList)target; GetTarget = new SerializedObject(t); ThisList = GetTarget.FindProperty("list"); // Find the List in our script and create a refrence of it }