private void ProcessWaveScaling()
        {
            mWavePattern.Update();

            if (!this.mWavePattern.Finished)
            {
                var scalar = mMaximumScalar * mWavePattern.CurrentValue;
                mHost.localScale = new Vector3(scalar * mSignX,
                                               scalar * mSignY,
                                               1f);
            }
        }
示例#2
0
        private void ProcessWaveScaling()
        {
            mWavePattern.Update();

            if (!this.mWavePattern.Finished)
            {
                float scalar = this.OverScaleFactor * mWavePattern.CurrentValue;
                this.transform.localScale = new Vector3(mBaseScale.x + scalar * mSignX,
                                                        mBaseScale.y + scalar * mSignY,
                                                        1f);
            }
        }
示例#3
0
        private void Update()
        {
            // If we had a host, and now we don't; kill this object.
            if (mHasHost && this.FollowHost == null)
            {
                Destroy(this.gameObject);
            }

            float moveX = 0f;
            float moveY = 0f;

            if (this.FloatingRange.x > 0f)
            {
                mXTimer.Update();

                if (mXTimer.Finished)
                {
                    mXState = !mXState;
                    StartXTimer();
                }

                moveX = (mXTimer.CurrentValue * this.FloatingRange.x) * (mXState ? 1f : -1f) * Time.timeScale;
            }

            if (this.FloatingRange.y > 0f)
            {
                mYTimer.Update();

                if (mYTimer.Finished)
                {
                    mYState = !mYState;
                    StartYTimer();
                }

                moveY = (mYTimer.CurrentValue * this.FloatingRange.y) * (mYState ? 1f : -1f) * Time.timeScale;
            }

            Vector3 delta = new Vector3(moveX + this.PositionOffset.x, moveY + this.PositionOffset.y, 0f);

            if (this.FollowHost != null)
            {
                this.transform.position = this.FollowHost.transform.position + delta;
            }
            else
            {
                this.transform.Translate(delta);
            }
        }
示例#4
0
        public void Update()
        {
            this.mElapsedTime += Time.deltaTime;

            mWaveFunction.Update();
            var windForceRange = this.WindForce;

            if (mVariancePace++ >= VariancePacing)
            {
                mVariancePace = 0;
                var variance = this.WindForce * this.WindVariancePercentage;
                windForceRange += Random.Range(-variance, variance);
            }

            var appliedForce = mWaveFunction.CurrentValue * Mathf.Lerp(windForceRange, 0f, Mathf.Min((mElapsedTime / this.MovementDuration), 1f));

            this.Body.AddForce(appliedForce, 0f, 0f, ForceMode.Force);
        }
 public void Update()
 {
     mWindModel.Update();
 }