Beispiel #1
0
        public IEnumerator StreamData()
        {
            var wait = new WaitForSeconds(1 / 10f);

            while (true)
            {
                SimManager.GetData(this);
                if (TimeKeeper.DeltaFrame() > Constants.CoroutineTimeSlice)
                {
                    yield return(null);
                }

                yield return(wait);
            }
        }
        public IEnumerator Generate()
        {
            var time = TimeKeeper.Chronos.Get();

            while (true)
            {
                time.Now();
                var f = Random.value;
                while (f >= 1)
                {
                    f = Random.value;
                }
                var dt = -Mathf.Log(1 - f) / _lambda;

                while (time.Timer() < dt)
                {
                    yield return(null);
                }

                var v = Position;
                v.y = 200;
                Vector3 d = Random.insideUnitCircle * (SimManager.Mode == SimulationMode.Delivery ? 7000 : 3500);
                d.z = d.y;
                d  += Position;
                d.y = 200;
                while (!Physics.Raycast(new Ray(d, Vector3.down), 200, 1 << 13) || Vector3.Distance(v, d) < 100)
                {
                    d   = Random.insideUnitCircle * (SimManager.Mode == SimulationMode.Delivery ? 7000 : 2750);
                    d.z = d.y;
                    d  += Position;
                    d.y = 200;
                    if (TimeKeeper.DeltaFrame() < 16)
                    {
                        continue;
                    }
                    yield return(null);
                }
                d.y = 0;
                var job = new Job(_owner, d);

                _owner.OnJobCreate(job);
                yield return(_capper);
            }
        }
Beispiel #3
0
        public IEnumerator StreamData()
        {
            var wait = new WaitForSeconds(Random.Range(1, 2));

            while (Source != null)
            {
                Source.GetData(this);
                if (TimeKeeper.DeltaFrame() > Constants.CoroutineTimeSlice)
                {
                    yield return(null);
                }
                if (Source.IsDataStatic)
                {
                    break;
                }
                yield return(wait);
            }
            yield break;
        }