private void OnDisable() { RandomizerForStorms.DestroyAllChildren(pirateParent); RandomizerForStorms.DestroyAllChildren(crewParent); RandomizerForStorms.DestroyAllChildren(crewParentInOrigin); RandomizerForStorms.DestroyAllChildren(crewSlotParent); }
public void WinGame() { rfs.StopDamageTimer(); ShipHealth h = GetComponent <ShipHealth>(); //Figure out clout change based on damage taken relative to max health float percentDamage = h.Health / h.MaxHealth; int damageBracket = RandomizerForStorms.GetBracket(damageLevelPercents, percentDamage); int cloutGained = Mathf.CeilToInt((survivalGain.y - survivalGain.x) * percentDamage + survivalGain.x); string cloutText = damageLevelText[damageBracket] + "\n\n" + $"For making your way out of the storm with your ship intact, your clout has risen {Mathf.RoundToInt(cloutGained)}." + $" Combined with the {cloutChange} from the ritual, your clout has changed a total of {Mathf.RoundToInt(cloutGained + cloutChange)}."; Globals.GameVars.AdjustPlayerClout(cloutGained + cloutChange, false); mgInfo.gameObject.SetActive(true); mgInfo.DisplayText( Globals.GameVars.stormTitles[3], Globals.GameVars.stormSubtitles[3], Globals.GameVars.stormSuccessText[0] + "\n\n" + cloutText + "\n\n" + Globals.GameVars.stormSuccessText[Random.Range(1, Globals.GameVars.stormSuccessText.Count)], stormIcon, MiniGameInfoScreen.MiniGame.Finish); finishButton.GetComponentInChildren <TMPro.TextMeshProUGUI>().text = winFinishText; finishButton.onClick.RemoveAllListeners(); finishButton.onClick.AddListener(UnloadMinigame); GetComponent <StormMGmovement>().ToggleMovement(false); }
private void Start() { rfs = GetComponent <RandomizerForStorms>(); }