public void TickSensors(float time) { for (int index = 0; index < this.Sensors.Count; ++index) { INpcSensor sensor = this.Sensors[index]; float deltaTime = time - sensor.LastTickTime; if (this.CanTickSensor(deltaTime, sensor)) { this.TickSensor(sensor, deltaTime, time); sensor.LastTickTime = time + Random.get_value() * 0.075f; } } }
public void TickSensors(float time) { for (int i = 0; i < this.Sensors.Count; i++) { INpcSensor item = this.Sensors[i]; float single = time - item.LastTickTime; if (this.CanTickSensor(single, item)) { this.TickSensor(item, single, time); item.LastTickTime = time + UnityEngine.Random.@value * 0.075f; } } }
protected abstract void TickSensor(INpcSensor sensor, float deltaTime, float time);
protected virtual bool CanTickSensor(float deltaTime, INpcSensor sensor) { return((double)deltaTime >= (double)sensor.TickFrequency); }