// Use this for initialization void Start() { //get reference to boat camera playerBoatCamera = Camera.main.GetComponent <BoatCameraNetworked>(); //initialize slider values to values of boat camera (loaded from playerprefs) verticalSensitivitySlider.value = tempVerticalSensitivity = playerBoatCamera.VerticalSensitivity; horizontalSensitivitySlider.value = tempHorizontalSensitivity = playerBoatCamera.HorizontalSensitivity; scrollSensitivitySlider.value = tempScrollSensitivity = playerBoatCamera.ScrollSensitivity; invertVerticalToggle.isOn = tempInvertHorizontal = playerBoatCamera.InvertHorizontal; invertHorizontalToggle.isOn = tempInvertVertical = playerBoatCamera.InvertVertical; //set callback functions for sliders and buttons and toggles verticalSensitivitySlider.onValueChanged.AddListener(delegate { VerticalSensitivityChangedProcess(); }); horizontalSensitivitySlider.onValueChanged.AddListener(delegate { HorizontalSensitivityChangedProcess(); }); scrollSensitivitySlider.onValueChanged.AddListener(delegate { ScrollSensitivityChangedProcess(); }); invertVerticalToggle.onValueChanged.AddListener(delegate { InvertVerticalToggleChangedProcess(); }); invertHorizontalToggle.onValueChanged.AddListener(delegate { InvertHorizontalToggleChangedProcess(); }); okButton.onClick.AddListener(OKButtonClickProcess); cancelButton.onClick.AddListener(CancelButtonClickProcess); verticalSensitivitySliderText.text = tempVerticalSensitivity.ToString("0.0"); horizontalSensitivitySliderText.text = tempHorizontalSensitivity.ToString("0.0"); scrollSensitivitySliderText.text = tempScrollSensitivity.ToString("0.0"); }
// Use this for initialization private void Start() { boat = this.GetComponent <Rigidbody>(); //Only perform the following for THIS player's boat if (!isLocalPlayer) { return; } //Make orbital and boat camera follow boat boatCam = Camera.main.GetComponent <BoatCameraNetworked>(); orbCam = Camera.main.GetComponent <OrbitalCamera>(); orbCam.target = this.gameObject; Camera.main.GetComponent <OrbitalCamera>().enabled = false; boatCam.boatToFollow = this.gameObject; //Get cannon scripts from all cannons cannonScripts = new List <BroadsideCannonFireNetworked>(this.GetComponentsInChildren <BroadsideCannonFireNetworked>().Where(t => t.GetType() != typeof(SwivelGun))); swivelGunScripts = new List <SwivelGun>(this.GetComponentsInChildren <SwivelGun>()); }