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 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; 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; } else if (result == PDAScanner.Result.Done || result == PDAScanner.Result.Researched) { idleTimer = 0.5f; PDASounds.queue.PlayIfFree(completeSound); if (fxControl != null) { fxControl.Play(0); } } } return(result); }