コード例 #1
0
        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);
        }
コード例 #2
0
 public RegenPowerSourceInfo(PowerSource source) : base(source, TechType.PowerCell)
 {
     regen = source.gameObject.GetComponent <RegeneratePowerSource>();
 }