示例#1
0
        internal void Validate(WaterSimulationModuleParameters parameters)
        {
            Damping   = parameters.Damping;
            Stiffness = parameters.Stiffness;
            Spread    = parameters.Spread;
            bool recomputeMesh = parameters.FirstCustomBoundary != FirstCustomBoundary || parameters.SecondCustomBoundary != SecondCustomBoundary;

            FirstCustomBoundary     = parameters.FirstCustomBoundary;
            SecondCustomBoundary    = parameters.SecondCustomBoundary;
            IsUsingCustomBoundaries = parameters.IsUsingCustomBoundaries;
            if (recomputeMesh)
            {
                _meshModule.RecomputeMeshData();
            }
        }
示例#2
0
        public WaterSimulationModule(Game2DWater waterObject, WaterSimulationModuleParameters parameters)
        {
            _waterObject = waterObject;

            _damping                 = parameters.Damping;
            _stiffness               = parameters.Stiffness;
            _spread                  = parameters.Spread;
            _firstCustomBoundary     = parameters.FirstCustomBoundary;
            _secondCustomBoundary    = parameters.SecondCustomBoundary;
            _isUsingCustomBoundaries = parameters.IsUsingCustomBoundaries;

            _stiffnessSquareRoot = Mathf.Sqrt(_stiffness);
            _leftCustomBoundary  = Mathf.Min(_firstCustomBoundary, _secondCustomBoundary);
            _rightCustomBoundary = Mathf.Max(_firstCustomBoundary, _secondCustomBoundary);
        }
        public WaterSimulationModule(Game2DWater waterObject, WaterSimulationModuleParameters parameters)
        {
            _waterObject = waterObject;

            _damping                         = parameters.Damping;
            _stiffness                       = parameters.Stiffness;
            _spread                          = parameters.Spread;
            _firstCustomBoundary             = parameters.FirstCustomBoundary;
            _secondCustomBoundary            = parameters.SecondCustomBoundary;
            _isUsingCustomBoundaries         = parameters.IsUsingCustomBoundaries;
            _maximumdDynamicWavesDisturbance = parameters.MaximumDynamicWavesDisturbance;
            _limitDynamicWavesDisturbance    = parameters.LimitDynamicWavesDisturbance;
            _areSineWavesActive              = parameters.AreSineWavesActive;
            _sineWavesParameters             = parameters.SineWavesParameters;
            _canWavesAffectRigidbodies       = parameters.CanWavesAffectRigidbodies;
            _wavesStrengthOnRigidbodies      = parameters.WavesStrengthOnRigidbodies;

            _stiffnessSquareRoot = Mathf.Sqrt(_stiffness);
            _leftCustomBoundary  = Mathf.Min(_firstCustomBoundary, _secondCustomBoundary);
            _rightCustomBoundary = Mathf.Max(_firstCustomBoundary, _secondCustomBoundary);
        }
        internal void Validate(WaterSimulationModuleParameters parameters)
        {
            bool recomputeMesh = parameters.FirstCustomBoundary != FirstCustomBoundary || parameters.SecondCustomBoundary != SecondCustomBoundary;

            Damping                        = parameters.Damping;
            Stiffness                      = parameters.Stiffness;
            Spread                         = parameters.Spread;
            FirstCustomBoundary            = parameters.FirstCustomBoundary;
            SecondCustomBoundary           = parameters.SecondCustomBoundary;
            IsUsingCustomBoundaries        = parameters.IsUsingCustomBoundaries;
            MaximumDynamicWavesDisturbance = parameters.MaximumDynamicWavesDisturbance;
            LimitDynamicWavesDisturbance   = parameters.LimitDynamicWavesDisturbance;
            AreSineWavesActive             = parameters.AreSineWavesActive;
            SineWavesParameters            = parameters.SineWavesParameters;
            CanWavesAffectRigidbodies      = parameters.CanWavesAffectRigidbodies;
            WavesStrengthOnRigidbodies     = parameters.WavesStrengthOnRigidbodies;

            if (recomputeMesh)
            {
                _meshModule.RecomputeMeshData();
            }
        }