// Update is called once per frame
    protected override void UpdateBehaviour()
    {
        base.UpdateBehaviour();
        _colorTween.Step();
        if (Mathf.Abs(_colorTween.position - _colorTween.target) < 0.01f)
        {
            _colorTween.target = Random.value;
        }
        _decayTween.Step();
        _audio._decay = _decayTween.position;
        if (!_destroyed)
        {
            if (selected)
            {
                _scaleTween.target = 1.3f;
                _colorTween.omega  = 5;
            }
            else
            {
                _scaleTween.target = 1f;
                _colorTween.omega  = 0.5f;
            }
        }
        _renderer.material.color = BaseColor = Color.HSVToRGB(_colorTween.position, 1, V * _decayTween.position);
        _scaleTween.Step();
        transform.localScale = new Vector3(_scaleTween.position, _scaleTween.position, _scaleTween.position);

        if (_destroyed && _scaleTween.position < 0.05f && _decayTween.position < 0.05f)
        {
            GameObject.Destroy(gameObject);
        }
    }
Exemple #2
0
    // Update is called once per frame
    void Update()
    {
        float target = Mathf.Clamp01(Weight / (3 + Weight));

        amplifier = Mathf.Exp(-Speed * Time.deltaTime) * (amplifier - target) + target;

        Volume = _volTween.Step(TargetVolume) * amplifier;
    }
Exemple #3
0
        void Update()
        {
            var target = Input.GetAxis("Horizontal") * _width;

            _position.omega = _omega;
            _position.Step(target);

            transform.position = _origin + Vector3.right * _position;
        }
    bool _updateAnimation()
    {
        if (_animationDone == true)
        {
            return(false);
        }

        _animTween.Step(MaxZ);
        Offset.z = _animTween.position;
        transform.localPosition = Offset;
        if (Mathf.Abs(Offset.z - MaxZ) < 0.01f)
        {
            Initial = GetEyePos();
            _motionTween.position = _motionTween.target = Offset;
            _animationDone        = true;
        }
        return(true);
    }
Exemple #5
0
    // Update is called once per frame
    void Update()
    {
        switch (_currentState)
        {
        case State.Calibration:
            if (CheckReset())
            {
                Reset();
            }
            break;

        case State.Idle:
        {
            if (CheckReset())
            {
                Reset();
            }
            break;
        }
        }


        _colorTween.Step();
        if (Mathf.Abs(_colorTween.position - _colorTween.target) < 0.05f)
        {
            _colorTween.position = _colorTween.target;
            _colorTween.target   = 1 - _colorTween.target;
        }

        //update instruction text color
        {
            var clr = Color.Lerp(Color1, Color2, _colorTween.position);
            clr.a = _currAlpha;
            InstructionText.color = clr;
        }

        _bgmVolume.Step();
        BGM.volume = _bgmVolume.position;
    }
        void Update()
        {
            bool atOffset = Vector3.Distance(target.position, transform.position) <= _offsetDistance;

            if (_interpolator == Interpolator.Exponential)
            {
                if (_positionSpeed > 0 && !atOffset)
                {
                    transform.position = ETween.Step(transform.position, target.position, _positionSpeed);
                }
                if (_rotationSpeed > 0)
                {
                    transform.rotation = ETween.Step(transform.rotation, target.rotation, _rotationSpeed);
                }
            }
            else if (_interpolator == Interpolator.DampedSpring)
            {
                if (_positionSpeed > 0 && !atOffset)
                {
                    transform.position = DTween.Step(transform.position, target.position, ref _vposition, _positionSpeed);
                }
                if (_rotationSpeed > 0)
                {
                    transform.rotation = DTween.Step(transform.rotation, target.rotation, ref _vrotation, _rotationSpeed);
                }
            }
            else
            {
                if (_positionSpeed > 0 && !atOffset)
                {
                    transform.position = SpringPosition(transform.position, target.position);
                }
                if (_rotationSpeed > 0)
                {
                    transform.rotation = SpringRotation(transform.rotation, target.rotation);
                }
            }
        }
    void _process()
    {
        switch (_state)
        {
        case EState.Idle:
            break;

        case EState.Spawning:
        {
            if (_spawnTime >= 0)
            {
                float spawn = Config.SpawnAnimation.Evaluate(_spawnTime);
                Scale    = spawn;
                Lighting = spawn;
            }
            _spawnTime += Time.deltaTime * Config.spawnSpeed;
            if (_spawnTime > 1)
            {
                _state = EState.Active;
            }
        }
        break;

        case EState.Active:
        {
            float a = AttractorManager.Instance.CalculateAttraction(Position);
            Attraction    = _spring.Step(a);
            affectorColor = AttractorManager.Instance.CalculateAttractionColor(Position);

            float strength = Config.ClickAnimation.Evaluate(Attraction);
            Scale    = strength;
            Lighting = strength;
        }
        break;
        }
        //_renderer.material.color = Color.HSVToRGB (Config.H, Saturation, Lighting);
    }
 void Update()
 {
     if (_interpolator == Interpolator.Exponential)
     {
         if (_positionSpeed > 0)
         {
             transform.position = ETween.Step(transform.position, target.position, _positionSpeed);
         }
         if (_rotationSpeed > 0)
         {
             transform.rotation = ETween.Step(transform.rotation, target.rotation, _rotationSpeed);
         }
     }
     else if (_interpolator == Interpolator.DampedSpring)
     {
         if (_positionSpeed > 0)
         {
             transform.position = DTween.Step(transform.position, target.position, ref _vposition, _positionSpeed);
         }
         if (_rotationSpeed > 0)
         {
             transform.rotation = DTween.Step(transform.rotation, target.rotation, ref _vrotation, _rotationSpeed);
         }
     }
     else
     {
         if (_positionSpeed > 0)
         {
             transform.position = SpringPosition(transform.position, target.position);
         }
         if (_rotationSpeed > 0)
         {
             transform.rotation = SpringRotation(transform.rotation, target.rotation);
         }
     }
 }
Exemple #9
0
 // Token: 0x06002E88 RID: 11912 RVA: 0x000E2F04 File Offset: 0x000E1304
 private void Update()
 {
     if (this._interpolator == SmoothFollow.Interpolator.Exponential)
     {
         if (this._positionSpeed > 0f)
         {
             base.transform.position = ETween.Step(base.transform.position, this.target.position, this._positionSpeed);
         }
         if (this._rotationSpeed > 0f)
         {
             base.transform.rotation = ETween.Step(base.transform.rotation, this.target.rotation, this._rotationSpeed);
         }
     }
     else if (this._interpolator == SmoothFollow.Interpolator.DampedSpring)
     {
         if (this._positionSpeed > 0f)
         {
             base.transform.position = DTween.Step(base.transform.position, this.target.position, ref this._vposition, this._positionSpeed);
         }
         if (this._rotationSpeed > 0f)
         {
             base.transform.rotation = DTween.Step(base.transform.rotation, this.target.rotation, ref this._vrotation, this._rotationSpeed);
         }
     }
     else
     {
         if (this._positionSpeed > 0f)
         {
             base.transform.position = this.SpringPosition(base.transform.position, this.target.position);
         }
         if (this._rotationSpeed > 0f)
         {
             base.transform.rotation = this.SpringRotation(base.transform.rotation, this.target.rotation);
         }
     }
 }