private void Next() { value = RandFloat.GetBetween(value_range); interval_position = 0.0f; interval_length = RandFloat.GetBetween(interval_range); }
private void Start() { animation_time.Start(); current_animation = animated_sprite.GetDefaultAnimation(); random_offset = RandFloat.GetMagnitude(3600.0f); }
public BurstAudioSource Deploy() { return(new GameObject().AddComponent <BurstAudioSource>().Chain(s => s.Initialize( audio, RandFloat.GetVariance(volume, volume_variance), RandFloat.GetVariance(pitch, pitch_variance) ))); }
private void Next() { is_on = is_on.GetFlipped(); interval_length = is_on.ConvertBool( () => RandFloat.GetBetween(on_interval_range), () => RandFloat.GetBetween(off_interval_range) ); interval_total_time = 0.0f; }
protected override float Execute(float time, float delta) { if (drift_timer.Repeat()) { time_multiplier = RandFloat.GetVariance(1.0f, drift); drift_timer.RestartSetDurationInSeconds(RandFloat.GetBetween(0.100f, 0.250f)); } float drifted_delta = time_multiplier * delta; drifted_time += drifted_delta; return(ExecuteDrifted(drifted_time, drifted_delta)); }
//循环调用自身,周期性调用ProductCars IEnumerator CycleGen() { for (timer = 0f; timer < T; timer += Time.deltaTime) { yield return(0); } System.Random r = new System.Random(); int i; i = RandFloat.RandomInt(0, 6); switch (i) { case 0: SProductCars(); break; case 1: LProductCars(); //生成左转车 break; case 2: RProductCars(); //生成右转车 break; case 3: SProductCars(); LProductCars(); //生成左转车 break; case 4: LProductCars(); //生成左转车 RProductCars(); //生成右转车 break; case 5: RProductCars(); //生成右转车 SProductCars(); break; default: break; } T = 1f + Random.Range(minRandT, maxRandT);//随机周期 StartCoroutine(CycleGen()); }
static public Vector2 GetJitteredDirectionAngleInRadians(this Vector2 item, float magnitude) { return(item.GetAdjustDirectionAngleInRadians(RandFloat.GetMagnitude(magnitude))); }
static public Vector2 GetJitteredDirectionAngleInCustom(this Vector2 item, float magnitude, float period) { return(item.GetAdjustDirectionAngleInCustom(RandFloat.GetMagnitude(magnitude), period)); }
protected override float CalculateInterval() { return(RandFloat.GetBetween(range)); }
public Signal_Generator_Time() { random_offset = RandFloat.GetMagnitude(3600.0f); }