private void Start() { ac = ServiceLocator.GetAudioController(); timer = new Timer(UtilRandom.RangeWithCenter( secondsBetweenSounds, secondsBetweenSoundsVariance), TimerFinished, true); timer.Run(); }
private void Fire() { AudioClip clip = sounds.GetRandomElement(); ac.PlaySFX(clip); timer.SetSecondsTarget(clip.length + UtilRandom.RangeWithCenter( secondsBetweenSounds, secondsBetweenSoundsVariance)); }
protected override void Instantiated(GameObject obj, float secondsOverflow) { float magnitude = UtilRandom.RangeWithCenter(valueCenter, valueRadius); float direction = UtilRandom.RangeWithCenter(directionCenter, directionRadius); Vector2 velocity = Angle.FromDegrees(direction).GetHeadingVector() * magnitude; obj.GetComponent <Velocity2D>().SetVelocity(velocity); }
private void Start() { oscillator.enabled = false; lerper.enabled = true; lerper.Completed += LerpFinish; damage.Add(data.damage); timerIdle = new Timer(UtilRandom.RangeWithCenter(data.secondsToIdle, data.secondsToIdleVariance), TimerIdleFinish, false); timerIdle.Run(); }
private void Start() { timerWarning = new Timer(data.secondsOfWarning, WarningFinish, false); timerIdle = new Timer(data.secondsOfIdling, IdleFinish, false); timerWarning.Run(); GameObject warning = Instantiate(data.prefabWarning, transform); warning.transform.position = transform.position + Vector3.up * warningHeight; // Set the destroy time for the floor spike warning. warning.GetComponent <MonoTimer>().SetSecondsTarget(data.secondsOfWarning); damage.Add(data.damage); heightToRise = UtilRandom.RangeWithCenter(data.heightToRise, data.heightToRiseVariance); }
protected override void Instantiated(GameObject obj, float secondsOverflow) { obj.GetComponent <RootDamage>().Add(UtilRandom.RangeWithCenter(valueCenter, valueRadius)); }
protected override void Instantiated(GameObject obj, float secondsOverflow) { obj.GetComponent <AngularVelocity2D>().SetAngularVelocity(UtilRandom.RangeWithCenter(valueCenter, valueRadius)); }
protected override void Instantiated(GameObject obj, float secondsOverflow) { obj.GetComponent <MonoTimer>().SetSecondsTarget(UtilRandom.RangeWithCenter(valueCenter, valueRadius)); }
public void StartCooldown() { timerCooldown.SetSecondsTarget(UtilRandom.RangeWithCenter(secondsOfCooldown, secondsOfCooldownVariance)); timerCooldown.Run(); }