public void ReloadSettings() { _switchImgButtonsEnabled = _applicationSettingsService.Settings.ShowSwitchImageButtons; _showSwitchImgOnMouseOverWindow = _applicationSettingsService.Settings.ShowNextPrevControlsOnEnterWindow; pictureBox.BackColor = _applicationSettingsService.Settings.MainWindowBackgroundColor.ToColor(); _mouseHoverInfo = _switchImgButtonsEnabled ? new MouseHoverInfo() : null; }
void Update() { if (blueprintMode == BlueprintModes.rotating) { blueprintStructure.transform.Rotate(new Vector3(0, 1, 0), Time.deltaTime * rotationSpeed); } if (blueprintMode == BlueprintModes.expanding) { expandTimer += Time.deltaTime; if (expandTimer > expandDuration) { blueprintMode = BlueprintModes.rotating; } else { float newScale = expandTimer / expandDuration; blueprintStructure.transform.localScale = new Vector3(newScale, newScale, newScale); } } if (blueprintMode == BlueprintModes.rotating || blueprintMode == BlueprintModes.expanding) { MouseHoverInfo mhi = clickController.GetMouseHoverInfo(blueprintRange); if (mhi.IsHit && mhi.hoverObject.layer == LayerMask.NameToLayer("Terrain")) { blueprintStructure.transform.position = mhi.point; } } }
public MouseHoverInfo GetMouseHoverInfo(float range) { //update lastMouseHouseInfo if we haven't done it this frame if (lastMouseHouseInfo == null || lastMouseHouseInfo.frameNumber != Time.frameCount) { Vector3 pos = gameManager.GetPlayer().transform.position; RaycastHit rayCastHit = new RaycastHit(); bool isHit = Physics.Linecast(pos, pos + crew.GetCrewCamera().transform.forward *range, out rayCastHit); lastMouseHouseInfo = new MouseHoverInfo(rayCastHit); //Debug.Log (crew.GetCrewCamera()+ " "+isHit+" "+range); } return(lastMouseHouseInfo); }
void Update() { if (Input.GetMouseButtonDown(0)) { MouseHoverInfo mhi = GetMouseHoverInfo(crew.reachRange); if (mhi.IsHit) { ClickTransmitter clickTransmitter = mhi.hoverObject.GetComponent <ClickTransmitter>(); if (clickTransmitter != null) { HitClickTransmitter(clickTransmitter); } } } }
void Update() { if (Input.GetKeyDown(KeyCode.E)) { bool isDriving = occupiedRover != null; if (isDriving) { ExitRover(); } else { MouseHoverInfo mhi = clickController.GetMouseHoverInfo(reachRange); if (mhi.IsHit) { Rover newRover = mhi.hoverObject.GetComponent <Rover> (); EnterRover(newRover); } } } }