private IEnumerator SetupPowerSource() { RegeneratePowerSource component = null; while (!gameObject.TryGetComponent <RegeneratePowerSource>(out component)) { yield return(new WaitForSecondsRealtime(0.5f)); } component.regenerationThreshhold = this.regenerationThreshhold; component.regenerationAmount = 0f; while (!gameObject.TryGetComponent <PowerSource>(out powerSource)) { yield return(new WaitForSecondsRealtime(0.5f)); } powerSource.maxPower = this.regenerationThreshhold; bInitialised = true; base.InvokeRepeating("CheckThreshold", 1f, 1f); }
public RegenPowerSourceInfo(PowerSource source) : base(source, TechType.PowerCell) { regen = source.gameObject.GetComponent <RegeneratePowerSource>(); }