예제 #1
0
    public void SetDesire(float value)
    {
        //TODO: Predict better side with current speed and distance
        var cur = Value;

        var min  = Min;
        var half = (_animator.Max - min) * .5f;

        var a = Mathf.Abs(cur - (value + half));
        var b = Mathf.Abs((cur + half) - value);
        var c = Mathf.Abs(cur - value);

        if (c < a && c < b)
        {
            _animator.SetDesire(value); _animator.Force(cur);
        }
        else if (b < a)
        {
            _animator.SetDesire(value); _animator.Force(cur + half);
        }
        else
        {
            _animator.SetDesire(value + half); _animator.Force(cur);
        }
    }
예제 #2
0
    public void Init(AudioSourceConfiguration config, Transform anchor)
    {
        _anchor = anchor;

        _source      = GetComponent <AudioSource>();
        _source.loop = true;
        _source.Play();
        _source.volume = 0;
        _volume.Start(0);
        _volume.SetDesire(1);

        _config = config;
        config.SetConfiguration(_source);
        _source.volume = _volume.Value * config.Volume;
    }