private async Task <GameObject> GetSaberModel(Saber saber) { //return saber.GetComponentInChildren<SaberModelController>()?.gameObject; SaberModelController smc = null; var timeout = 2000; var interval = 300; var time = 0; while (!smc) { smc = saber.GetComponentInChildren <SaberModelController>(); if (smc) { return(smc.gameObject); } if (time > timeout) { return(null); } time += interval; await Task.Delay(interval); } return(null); }
void SetDefaultTrailLength(Saber saber) { var trail = saber.GetComponentInChildren <XWeaponTrail>(); int length = (int)(Configuration.TrailLength * 30); if (length < 2) { HideVanillaTrails(); return; } ReflectionUtil.SetField(trail, "_maxFrame", length); }
void SetDefaultTrailLength(Saber saber) { var trail = saber.GetComponentInChildren <SaberTrail>(); int length = (int)(Configuration.TrailLength * 30); if (length < 2) { HideVanillaTrails(); return; } trail.SetField("_trailDuration", length / 75f); }