public void SoftClear() { if (HasHighlightedTarget) { HighlightedTarget.RemoveTargetGlow(); } IronPulling = false; SteelPushing = false; SetVacuousTarget(null); RemoveAllTargets(); }
public override void StopBurning() { base.StopBurning(); if (HasHighlightedTarget) { HighlightedTarget.RemoveTargetGlow(); HighlightedTarget = null; } steelBurnPercentageLerp = 0; ironBurnPercentageLerp = 0; forceMagnitudeTarget = 0; GamepadController.SetRumble(0, 0); GetComponentInChildren <AllomechanicalGlower>().RemoveAllEmissions(); DisableRenderingBlueLines(); RefreshHUD(); }
/* * Read inputs for selecting targets. * Update burn percentages. * Update blue lines pointing from player to metal. */ private void LateUpdate() { if (!PauseMenu.IsPaused) { // Start and Stop Burning metals if (IsBurning) { // Stop burning if (Keybinds.StopBurning()) { StopBurning(); timeToStopBurning = 0; } else if (Keybinds.Negate()) { timeToStopBurning += Time.deltaTime; if (Keybinds.Select() && Keybinds.SelectAlternate() && timeToStopBurning > timeToHoldDown) { //if (Keybinds.IronPulling() && Keybinds.SteelPushing() && timeToStopBurning > timeToHoldDown) { StopBurning(); timeToStopBurning = 0; } } else { timeToStopBurning = 0; } } else { // Start burning if (!Keybinds.Negate()) { if (Keybinds.SelectDown()) { StartBurning(true); } else if (Keybinds.SelectAlternateDown()) { StartBurning(false); } } } // Could have stopped burning above. Check if the Allomancer is still burning. if (IsBurning) { // Change Burn Percentage Targets, Number of Targets // Check scrollwheel for changing the max number of targets and burn percentage, or DPad if using gamepad float scrollValue = 0; if (SettingsMenu.settingsData.controlScheme == SettingsData.Gamepad) // Gamepad { scrollValue = Keybinds.DPadYAxis(); if (SettingsMenu.settingsData.pushControlStyle == 1) { ChangeTargetForceMagnitude(Keybinds.DPadXAxis()); } } else // Mouse and keyboard { if (Keybinds.Negate()) { scrollValue = Keybinds.ScrollWheelAxis(); } else { if (SettingsMenu.settingsData.pushControlStyle == 0) { ChangeBurnPercentageTarget(Keybinds.ScrollWheelAxis()); } else { ChangeTargetForceMagnitude(Keybinds.ScrollWheelAxis()); } } } if (scrollValue > 0) { IncrementNumberOfTargets(); } if (scrollValue < 0) { DecrementNumberOfTargets(); } // Assign Burn percentage targets based on the previously changed burn percentage/target magnitudes if (SettingsMenu.settingsData.pushControlStyle == 0) // Percentage { if (SettingsMenu.settingsData.controlScheme == SettingsData.Gamepad) // Gamepad { SetPullPercentageTarget(Keybinds.RightBurnPercentage()); SetPushPercentageTarget(Keybinds.LeftBurnPercentage()); } } else // Magnitude { if (HasPullTarget || HasPushTarget) { //Debug.Log(player.LastMaximumNetForce); float maxNetForce = (LastMaximumNetForce).magnitude; SetPullPercentageTarget(forceMagnitudeTarget / maxNetForce); SetPushPercentageTarget(forceMagnitudeTarget / maxNetForce); } else { SetPullPercentageTarget(0); SetPushPercentageTarget(0); } } LerpToBurnPercentages(); UpdateBurnRateMeter(); if (Player.CanControlPlayer) { // Could have stopped burning above. Check if the Allomancer is still burning. if (IsBurning) { // Swap pull- and push- targets if (Keybinds.NegateDown() && timeToSwapBurning > Time.time) { // Double-tapped, Swap targets PullTargets.SwapContents(PushTargets); // If vacuously targeting, swap statuses of vacuous targets SwapVacuousTargets(); } else { if (Keybinds.NegateDown()) { timeToSwapBurning = Time.time + timeDoubleTapWindow; } } // Search for Metals bool pulling = Keybinds.IronPulling() && HasIron;// && !(Player.CoinshotMode && Keybinds.SteelPushing()); // in coinshot mode, you cannot push and pull simultaneously bool pushing = Keybinds.SteelPushing() && HasSteel; // If you are trying to push and pull and only have pullTargets, only push. And vice versa if (!HasPushTarget && HasPullTarget) { if (pulling) { pushing = false; } } else if (!HasPullTarget && HasPushTarget) { if (pushing) { pulling = false; } } IronPulling = pulling; SteelPushing = pushing; // Check input for target selection bool selecting = (Keybinds.Select() || Keybinds.SelectAlternate()) && !Keybinds.Negate(); Magnetic target = SearchForMetals(); if (target != null) { // highlight the potential target you would select, if you targeted it if (target != HighlightedTarget) { // Remove old target if (HasHighlightedTarget) { HighlightedTarget.RemoveTargetGlow(); } target.AddTargetGlow(); HighlightedTarget = target; } } else { // no target near center of screen; remove highlighted target if (HasHighlightedTarget) { HighlightedTarget.RemoveTargetGlow(); } HighlightedTarget = null; } // Add/Remove Targets // If vacuously targeting (or should be), if (VacuouslyPullTargeting || !HasPullTarget) { // If starting to pull/push again, replace that old vacuous target with the new target if (Keybinds.PullDown()) { SetVacuousTarget(target, iron); } // If releasing push/pull, remove vacuous target if (!Keybinds.IronPulling()) { SetVacuousTarget(null, iron); } } // Repeat for steel if (VacuouslyPushTargeting || !HasPushTarget) { if (Keybinds.PushDown()) { SetVacuousTarget(target, steel); } if (!Keybinds.SteelPushing()) { SetVacuousTarget(null, steel); } } // Manual target selection if (Keybinds.Select() || Keybinds.SelectAlternate()) { // Select or Deselect pullTarget and/or pushTarget if (Keybinds.Select() && HasIron) // Selecting pull target { if (selecting) { AddPullTarget(target); } else { if (RemovePullTarget(target)) // If the player is hovering over a pullTarget, instantly remove that one. Keep it highlighted. { target.AddTargetGlow(); } else if (Keybinds.SelectDown() && !RemovePullTarget(target)) // If the highlighted Magnetic is not a pullTarget, remove the oldest pullTarget instead { RemovePullTargetAt(0); } } } if (Keybinds.SelectAlternate() && HasSteel) { if (selecting) { AddPushTarget(target); } else { if (RemovePushTarget(target)) { target.AddTargetGlow(); } else if (Keybinds.SelectAlternateDown() && !RemovePushTarget(target)) { RemovePushTargetAt(0); } } } } RefreshHUD(); } } else // If the player is not in control, but still burning metals, show blue lines to metals. { if (IsBurning) { SearchForMetals(false); LerpToBurnPercentages(); UpdateBurnRateMeter(); RefreshHUD(); } } } } }