Ejemplo n.º 1
0
        public WaterConstantRipplesModule(Game2DWater waterObject, WaterConstantRipplesModuleParameters parameters, Transform ripplesEffectsRoot)
        {
            _waterObject = waterObject;

            _isActive                             = parameters.IsActive;
            _updateWhenOffscreen                  = parameters.UpdateWhenOffscreen;
            _randomizeDisturbance                 = parameters.RandomizeDisturbance;
            _smoothRipples                        = parameters.SmoothDisturbance;
            _smoothingFactor                      = parameters.SmoothFactor;
            _disturbance                          = parameters.Disturbance;
            _minimumDisturbance                   = parameters.MinimumDisturbance;
            _maximumDisturbance                   = parameters.MaximumDisturbance;
            _randomizeTimeInterval                = parameters.RandomizeInterval;
            _timeInterval                         = parameters.Interval;
            _minimumTimeInterval                  = parameters.MinimumInterval;
            _maximumTimeInterval                  = parameters.MaximumInterval;
            _randomizeRipplesSourcePositions      = parameters.RandomizeRipplesSourcesPositions;
            _randomRipplesSourceCount             = parameters.RandomizeRipplesSourcesCount;
            _allowDuplicateRipplesSourcePositions = parameters.AllowDuplicateRipplesSourcesPositions;
            _sourcePositions                      = parameters.SourcePositions;

            _ripplesEffectsRoot = CreateRipplesEffectsRoot(ripplesEffectsRoot);

            _particleEffect = new WaterRipplesParticleEffect(parameters.ParticleEffectParameters, _ripplesEffectsRoot);
            _soundEffect    = new WaterRipplesSoundEffect(parameters.SoundEffectParameters, _ripplesEffectsRoot);
        }
Ejemplo n.º 2
0
        internal void Validate(WaterConstantRipplesModuleParameters parameters)
        {
            IsActive                             = parameters.IsActive;
            UpdateWhenOffscreen                  = parameters.UpdateWhenOffscreen;
            RandomizeDisturbance                 = parameters.RandomizeDisturbance;
            SmoothRipples                        = parameters.SmoothDisturbance;
            SmoothingFactor                      = parameters.SmoothFactor;
            Disturbance                          = parameters.Disturbance;
            MinimumDisturbance                   = parameters.MinimumDisturbance;
            MaximumDisturbance                   = parameters.MaximumDisturbance;
            RandomizeTimeInterval                = parameters.RandomizeInterval;
            TimeInterval                         = parameters.Interval;
            MinimumTimeInterval                  = parameters.MinimumInterval;
            MaximumTimeInterval                  = parameters.MaximumInterval;
            RandomizeRipplesSourcePositions      = parameters.RandomizeRipplesSourcesPositions;
            RandomRipplesSourceCount             = parameters.RandomizeRipplesSourcesCount;
            AllowDuplicateRipplesSourcePositions = parameters.AllowDuplicateRipplesSourcesPositions;
            SourcePositions                      = parameters.SourcePositions;

            _particleEffect.Validate(parameters.ParticleEffectParameters);
            _soundEffect.Validate(parameters.SoundEffectParameters);

            if (Application.isPlaying)
            {
                RecomputeIndices();
            }
        }