public void Start() { discoBallTransform = internalProp.FindModelTransform(transformName); propStateHelper = this.part.FindModuleImplementing <WBIPropStateHelper>(); rotationsPerFrame = rotationsPerMinute * 6.0f * TimeWarp.fixedDeltaTime; }
public void Start() { //Flag transform flagTransform = internalProp.FindModelTransform(flagTransformName); if (flagTransform == null) { return; } //Render material rendererMaterial = flagTransform.GetComponent <Renderer>(); //Flag to show propStateHelper = this.part.FindModuleImplementing <WBIPropStateHelper>(); if (propStateHelper != null) { imageURL = propStateHelper.LoadProperty(internalProp.propID, "imageURL"); //Use mission flag if we have none set. if (string.IsNullOrEmpty(imageURL)) { imageURL = HighLogic.CurrentGame.flagURL; } } else //Use mission flag. { imageURL = HighLogic.CurrentGame.flagURL; } setFlagImage(); //Trigger Transform trans = internalProp.FindModelTransform("Collider"); if (trans != null) { GameObject goButton = trans.gameObject; if (goButton != null) { ButtonClickWatcher clickWatcher = goButton.GetComponent <ButtonClickWatcher>(); if (clickWatcher == null) { clickWatcher = goButton.AddComponent <ButtonClickWatcher>(); } clickWatcher.clickDelegate = OnFlagClick; } } }
public void Start() { propStateHelper = this.part.FindModuleImplementing <WBIPropStateHelper>(); if (propStateHelper != null) { List <ModuleAnimateGeneric> animators = this.part.FindModulesImplementing <ModuleAnimateGeneric>(); foreach (ModuleAnimateGeneric animator in animators) { if (animator.animationName == propStateHelper.animationName) { buttonAnimation = animator; break; } } } //Get the transform and setup click watcher Transform trans = internalProp.FindModelTransform(buttonName); if (trans != null) { GameObject goButton = trans.gameObject; if (goButton != null) { ButtonClickWatcher clickWatcher = goButton.GetComponent <ButtonClickWatcher>(); if (clickWatcher == null) { clickWatcher = goButton.AddComponent <ButtonClickWatcher>(); } clickWatcher.clickDelegate = OnButtonClick; } } //Setup button string[] rgbString = buttonColorOn.Split(new char[] { ',' }); colorButtonOn = new Color(float.Parse(rgbString[0]), float.Parse(rgbString[1]), float.Parse(rgbString[2])); rgbString = buttonColorOff.Split(new char[] { ',' }); colorButtonOff = new Color(float.Parse(rgbString[0]), float.Parse(rgbString[1]), float.Parse(rgbString[2])); Renderer colorShiftRenderer = internalProp.FindModelComponent <Renderer>(buttonName); colorShiftMaterial = colorShiftRenderer.material; SetButtonColor(); }
public void Start() { if (HighLogic.LoadedSceneIsFlight == false) { return; } screenView = new PlasmaScreenView(); getDefaultTexture(); //Get the screen's render material Transform target = internalProp.FindModelTransform(screenTransform); if (target == null) { return; } rendererMaterial = target.GetComponent <Renderer>(); if (showAlphaControl) { SetScreenVisible(screenIsVisible); } //Get the prop state helper. propStateHelper = this.part.FindModuleImplementing <WBIPropStateHelper>(); if (propStateHelper != null) { imagePath = propStateHelper.LoadProperty(internalProp.propID, "imagePath"); if (string.IsNullOrEmpty(imagePath) == false && System.IO.File.Exists(imagePath)) { Texture2D image = new Texture2D(1, 1); WWW www = new WWW("file://" + imagePath); www.LoadImageIntoTexture(image); ShowImage(image, imagePath); } string value = propStateHelper.LoadProperty(internalProp.propID, "enableRandomScreens"); if (string.IsNullOrEmpty(value) == false) { enableRandomImages = bool.Parse(value); } if (enableRandomImages) { cycleStartTime = Planetarium.GetUniversalTime(); } value = propStateHelper.LoadProperty(internalProp.propID, "screenSwitchTime"); if (string.IsNullOrEmpty(value) == false) { screenSwitchTime = float.Parse(value); } value = propStateHelper.LoadProperty(internalProp.propID, "screenIsVisible"); if (string.IsNullOrEmpty(value) == false) { screenIsVisible = bool.Parse(value); } } Transform trans = internalProp.FindModelTransform("ScreenTrigger"); if (trans != null) { GameObject goButton = trans.gameObject; if (goButton != null) { ButtonClickWatcher clickWatcher = goButton.GetComponent <ButtonClickWatcher>(); if (clickWatcher == null) { clickWatcher = goButton.AddComponent <ButtonClickWatcher>(); } clickWatcher.clickDelegate = OnScreenClick; } } //Setup screen view screenView.showImageDelegate = ShowImage; screenView.toggleScreenDelegate = SetScreenVisible; screenView.showAlphaControl = this.showAlphaControl; }
public void Start() { lightModule = this.part.FindModuleImplementing <WBILight>(); if (lightModule != null) { if (lightModule.isDeployed && !setLightColor) { lightState = ELightStates.On; } else if (lightModule.isDeployed && setLightColor) { lightState = ELightStates.MainColor; } } propStateHelper = this.part.FindModuleImplementing <WBIPropStateHelper>(); if (propStateHelper != null) { string value = propStateHelper.LoadProperty(internalProp.propID, "lightState"); if (string.IsNullOrEmpty(value) == false) { lightState = (ELightStates)(int.Parse(value)); } } //Get the transform and setup click watcher Transform trans = internalProp.FindModelTransform(buttonName); if (trans != null) { GameObject goButton = trans.gameObject; if (goButton != null) { ButtonClickWatcher clickWatcher = goButton.GetComponent <ButtonClickWatcher>(); if (clickWatcher == null) { clickWatcher = goButton.AddComponent <ButtonClickWatcher>(); } clickWatcher.clickDelegate = OnButtonClick; } } //Setup button string[] rgbString = buttonColorOn.Split(new char[] { ',' }); colorButtonOn = new Color(float.Parse(rgbString[0]), float.Parse(rgbString[1]), float.Parse(rgbString[2])); rgbString = buttonColorOff.Split(new char[] { ',' }); colorButtonOff = new Color(float.Parse(rgbString[0]), float.Parse(rgbString[1]), float.Parse(rgbString[2])); Renderer colorShiftRenderer = internalProp.FindModelComponent <Renderer>(buttonName); colorShiftMaterial = colorShiftRenderer.material; if (setLightColor) { rgbString = primaryLightColor.Split(new char[] { ',' }); mainLightColor = new Color(float.Parse(rgbString[0]), float.Parse(rgbString[1]), float.Parse(rgbString[2])); rgbString = secondaryLightColor.Split(new char[] { ',' }); altLightColor = new Color(float.Parse(rgbString[0]), float.Parse(rgbString[1]), float.Parse(rgbString[2])); } SetButtonColor(); //Setup lights SetupLights(); }