public void Tick(ITimedService service)
        {
            var values = new ObjectShakeEffect.PingPongValues();

            values.Randomize();
            float timeUntilNextShake = 0;

            while (timePassed >= totalDuration)
            {
                if (timeUntilNextShake < 0)
                {
                    currentShake =
                        ObjectShakeEffect.GetOffset(context, timePassed, values, mode, intensity, dimensions);
                    timeUntilNextShake = 1 / frequency.Evaluate(context, timePassed);
                    values.Toggle();
                }

                timePassed         += Time.deltaTime;
                timeUntilNextShake -= Time.deltaTime;
            }
        }
Ejemplo n.º 2
0
        private static Service FindNewest(IEnumerable <Service> services)
        {
            ITimedService timedService = null;

            foreach (var activeService in services)
            {
                var s = activeService as ITimedService;
                if (s == null)
                {
                    //Doesn't have time, consider duration always 0
                    return(activeService);
                }

                if (timedService == null || timedService.TimeLeft < s.TimeLeft)
                {
                    timedService = s;
                }
            }

            return((Service)timedService);
        }
Ejemplo n.º 3
0
 public void Tick(ITimedService service)
 {
     currentPosition = service.PercentageCompleted;
 }