예제 #1
0
        private void Next()
        {
            value = RandFloat.GetBetween(value_range);

            interval_position = 0.0f;
            interval_length   = RandFloat.GetBetween(interval_range);
        }
예제 #2
0
        private void Start()
        {
            animation_time.Start();
            current_animation = animated_sprite.GetDefaultAnimation();

            random_offset = RandFloat.GetMagnitude(3600.0f);
        }
예제 #3
0
 public BurstAudioSource Deploy()
 {
     return(new GameObject().AddComponent <BurstAudioSource>().Chain(s => s.Initialize(
                                                                         audio,
                                                                         RandFloat.GetVariance(volume, volume_variance),
                                                                         RandFloat.GetVariance(pitch, pitch_variance)
                                                                         )));
 }
예제 #4
0
        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;
        }
예제 #5
0
        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));
        }
예제 #6
0
    //循环调用自身,周期性调用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());
    }
예제 #7
0
 static public Vector2 GetJitteredDirectionAngleInRadians(this Vector2 item, float magnitude)
 {
     return(item.GetAdjustDirectionAngleInRadians(RandFloat.GetMagnitude(magnitude)));
 }
예제 #8
0
 static public Vector2 GetJitteredDirectionAngleInCustom(this Vector2 item, float magnitude, float period)
 {
     return(item.GetAdjustDirectionAngleInCustom(RandFloat.GetMagnitude(magnitude), period));
 }
예제 #9
0
 protected override float CalculateInterval()
 {
     return(RandFloat.GetBetween(range));
 }
예제 #10
0
 public Signal_Generator_Time()
 {
     random_offset = RandFloat.GetMagnitude(3600.0f);
 }