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);
    }
示例#4
0
    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();
    }
示例#5
0
    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));
 }
示例#7
0
 protected override void Instantiated(GameObject obj, float secondsOverflow)
 {
     obj.GetComponent <AngularVelocity2D>().SetAngularVelocity(UtilRandom.RangeWithCenter(valueCenter, valueRadius));
 }
示例#8
0
 protected override void Instantiated(GameObject obj, float secondsOverflow)
 {
     obj.GetComponent <MonoTimer>().SetSecondsTarget(UtilRandom.RangeWithCenter(valueCenter, valueRadius));
 }
示例#9
0
 public void StartCooldown()
 {
     timerCooldown.SetSecondsTarget(UtilRandom.RangeWithCenter(secondsOfCooldown,
                                                               secondsOfCooldownVariance));
     timerCooldown.Run();
 }