private PDAScanner.Result Scan() { if (stateCurrent != ScanState.None) { return(PDAScanner.Result.None); } if (idleTimer > 0f) { return(PDAScanner.Result.None); } PDAScanner.Result result = PDAScanner.Result.None; PDAScanner.ScanTarget scanTarget = PDAScanner.scanTarget; PDAScanner.UpdateTarget(scanDistance, false); if (scanTarget.isValid && energyMixin.charge > 0f) { result = PDAScanner.Scan(); if (result == PDAScanner.Result.Scan) { float amount = powerConsumption * Time.deltaTime; energyMixin.ConsumeEnergy(amount); stateCurrent = ScanState.Scan; isScanning = true; } else if (result == PDAScanner.Result.Done || result == PDAScanner.Result.Researched) { idleTimer = 0.5f; PDASounds.queue.PlayIfFree(completeSoundAsset); } } return(result); }
private void OnHover() { if (energyMixin.charge <= 0f) { return; } PDAScanner.ScanTarget scanTarget = PDAScanner.scanTarget; PDAScanner.UpdateTarget(scanDistance, false); if (!scanTarget.isValid) { return; } PDAScanner.Result result = PDAScanner.CanScan(); if (result == PDAScanner.Result.Scan) { HandReticle main = HandReticle.main; main.SetInteractText(scanTarget.techType.AsString(false), true, HandReticle.Hand.Left); main.SetIcon(HandReticle.IconType.Scan, 1.5f); if (stateCurrent == ScanState.Scan) { main.SetIcon(HandReticle.IconType.Progress, 4f); main.progressText.text = Mathf.RoundToInt(PDAScanner.scanTarget.progress * 100f) + "%"; SetProgressColor(Colors.Green); main.progressImage.fillAmount = Mathf.Clamp01(PDAScanner.scanTarget.progress); main.SetProgress(PDAScanner.scanTarget.progress); } } }
private void OnHover() { if (energyMixin.charge <= 0f) { return; } PDAScanner.ScanTarget scanTarget = PDAScanner.scanTarget; PDAScanner.UpdateTarget(scanDistance, false); if (!scanTarget.isValid) { return; } PDAScanner.Result result = PDAScanner.CanScan(); }