public IEnumerator WaitForRay() { yield return(new WaitForSeconds(1)); _isRayEnabled = false; var target = new TargetHelper(ThisPart); target.Update(); Vector3 endPoint; if (target.Destination <= _allowedScanDistance && IsInsight(out endPoint) && IsTargetVisiable()) { ScreenMessages.PostScreenMessage(FlightGlobals.activeTarget.vessel.vesselName + " HAS BEEN SCANNED", 3f, ScreenMessageStyle.UPPER_CENTER); if (!_isScienceActivate) { var spyScience = ThisPart.GetComponent <ModuleSpyExperiment>(); if (spyScience != null) { spyScience.DeployExperiment(); } _isScienceActivate = true; } } else { ScreenMessages.PostScreenMessage("NO DATA, TARGET " + FlightGlobals.activeTarget.vessel.vesselName + " IS OUT OF RANGE OR VISIBILITY", 3f, ScreenMessageStyle.UPPER_CENTER); } }
public IPart DeepCopy() { ThisPart part = new ThisPart(); part.mIsCxx = mIsCxx; return(part); }
private void DrawButtonsBlock(float widthOffset) { if (GUI.Button(new Rect(widthOffset, 36, ButtonSize, ButtonSize), "↻")) { _camObject.transform.Rotate(new Vector3(0, 0, 180f)); _isUpsideDown = !_isUpsideDown; } if (GUI.RepeatButton(new Rect(widthOffset + ButtonSize, 36, ButtonSize, ButtonSize), "↑")) { if (_rotateYbuffer < 180) { if (!_isUpsideDown) { RotateY += _rotateStep; } else { RotateY -= _rotateStep; } } } if (GUI.Button(new Rect(widthOffset + ButtonSize * 2, 36, ButtonSize, ButtonSize), "⦿")) { if (ThisPart.vessel.Equals(FlightGlobals.ActiveVessel)) { if (!TargetHelper.IsTargetSelect) { ScreenMessages.PostScreenMessage("NO TARGET FOR SCANNING", 3f, ScreenMessageStyle.UPPER_CENTER); } else { if (Hits <= 0) { ScreenMessages.PostScreenMessage("BULLETS DEPLETED", 3f, ScreenMessageStyle.UPPER_CENTER); } else { var id = PartResourceLibrary.Instance.GetDefinition(_resourceName).id; double amount; double maxAmount; ThisPart.GetConnectedResourceTotals(id, out amount, out maxAmount); if (amount > _resourceUsage) { ThisPart.RequestResource(id, _resourceUsage); var hit = PartGameObject.GetChild($"{_bulletName}{Hits:000}"); Object.Destroy(hit); Hits--; _isRayEnabled = true; IsWaitForRay = true; _isScienceActivate = false; } else { ScreenMessages.PostScreenMessage("NOT ENOUGH ELECTRICITY FOR SCAN", 3f, ScreenMessageStyle.UPPER_CENTER); } } //if (HitCounter() && UseResourceForScanning()) //{ // _isRayEnabled = true; // IsWaitForRay = true; // _isScienceActivate = false; //} } } else { ScreenMessages.PostScreenMessage("Camera not on active vessel", 3f, ScreenMessageStyle.UPPER_CENTER); } } if (GUI.RepeatButton(new Rect(widthOffset, 36 + ButtonSize, ButtonSize, ButtonSize), "←")) { if (!_isUpsideDown) { RotateZ -= _rotateStep; } else { RotateZ += _rotateStep; } } if (GUI.Button(new Rect(widthOffset + ButtonSize, 36 + ButtonSize, ButtonSize, ButtonSize), "o")) { IsToZero = true; } if (GUI.RepeatButton(new Rect(widthOffset + ButtonSize * 2, 36 + ButtonSize, ButtonSize, ButtonSize), "→")) { if (!_isUpsideDown) { RotateZ += _rotateStep; } else { RotateZ -= _rotateStep; } } if (GUI.Button(new Rect(widthOffset, 36 + ButtonSize * 2, ButtonSize, ButtonSize), "-")) { CurrentZoom += 0.5f; if (CurrentZoom > MaxZoom) { CurrentZoom = MaxZoom; } } if (GUI.RepeatButton(new Rect(widthOffset + ButtonSize, 36 + ButtonSize * 2, ButtonSize, ButtonSize), "↓")) { if (_rotateYbuffer > 0) { if (!_isUpsideDown) { RotateY -= _rotateStep; } else { RotateY += _rotateStep; } } } if (GUI.Button(new Rect(widthOffset + ButtonSize * 2, 36 + ButtonSize * 2, ButtonSize, ButtonSize), "+")) { CurrentZoom -= 0.5f; if (CurrentZoom < MinZoom) { CurrentZoom = MinZoom; } } }