public override void InitializeModules() { if (_areModulesInitialized) { return; } _mainModule = new WaterMainModule(this, _size); _renderingModule = new WaterRenderingModule(this, GetRenderingModuleParameters()); _simulationModule = new WaterSimulationModule(this, GetSimulationModuleParameters()); _meshModule = new WaterMeshModule(this, subdivisionsCountPerUnit); _materialModule = new WaterMaterialModule(this); _animationModule = new WaterAnimationModule(this); _onCollisonRipplesModule = new WaterCollisionRipplesModule(this, GetCollisionRipplesModuleParameters(), GetRipplesEffectsPoolsRoot()); _constantRipplesModule = new WaterConstantRipplesModule(this, GetConstantRipplesModuleParameters(), GetRipplesEffectsPoolsRoot()); _scriptGeneratedRipplesModule = new WaterScriptGeneratedRipplesModule(this, GetScriptGeneratedRipplesModuleParameters(), GetRipplesEffectsPoolsRoot()); _waterfallRipplesModule = new WaterWaterfallRipplesModule(this); _attachedComponentsModule = new WaterAttachedComponentsModule(this, buoyancyEffectorSurfaceLevel, buoyancyEffectorSurfaceLevelLocation, boxColliderTopEdgeLocation); _mainModule.Initialize(); _simulationModule.Initialize(); _meshModule.Initialize(); _materialModule.Initialize(); _renderingModule.Initialize(); _attachedComponentsModule.Initialize(); _constantRipplesModule.Initialze(); _onCollisonRipplesModule.Initialize(); _scriptGeneratedRipplesModule.Initialize(); _waterfallRipplesModule.Initialize(); _animationModule.Initialze(); _areModulesInitialized = true; }
internal void Initialize() { _mainModule = _waterObject.MainModule; _materialModule = _waterObject.MaterialModule; _meshMask = _waterObject.RenderingModule.MeshMask; _hasAnimatorAttached = _mainModule.Transform.GetComponent <Animator>() != null; SetupBuoyancyEffector(); SetupBoxCollider(); SetupPolygonCollider(); SetupEdgeCollider(); _materialModule.OnSurfaceThicknessOrSubmergeLevelChanged += UpdateBoxColliderSizeAndOffset; _materialModule.OnSurfaceThicknessOrSubmergeLevelChanged += UpdateBuoyancySurfaceLevel; _cachedWaterSize = _mainModule.WaterSize; _cachedWaterPosition = _mainModule.Position; _cachedWaterScale = _mainModule.Scale; ApplyChanges(); }
public void InitializeModules() { if (_areModulesInitialized) { return; } _mainModule = new WaterMainModule(this, waterSize); _simulationModule = new WaterSimulationModule(damping, stiffness, spread, firstCustomBoundary, secondCustomBoundary, useCustomBoundaries); _meshModule = new Mesh.WaterMeshModule(subdivisionsCountPerUnit); _materialModule = new WaterMaterialModule(); _renderingModule = new WaterRenderingModule(GetRenderingModuleParameters(), RenderingCamerasRoot); _animationModule = new WaterAnimationModule(); _onCollisonRipplesModule = new WaterCollisionRipplesModule(GetCollisionRipplesModuleParameters(), RipplesEffectsPoolsRoot); _constantRipplesModule = new WaterConstantRipplesModule(GetConstantRipplesModuleParameters(), RipplesEffectsPoolsRoot); _scriptGeneratedRipplesModule = new WaterScriptGeneratedRipplesModule(GetScriptGeneratedRipplesModuleParameters(), RipplesEffectsPoolsRoot); _attachedComponentsModule = new WaterAttachedComponentsModule(buoyancyEffectorSurfaceLevel); _simulationModule.SetDependencies(_mainModule, _meshModule); _meshModule.SetDependencies(_mainModule, _simulationModule); _materialModule.SetDependencies(_meshModule); _renderingModule.SetDependencies(_mainModule, _meshModule, _materialModule); _animationModule.SetDependencies(_mainModule, _meshModule, _simulationModule); _onCollisonRipplesModule.SetDependencies(_mainModule, _meshModule, _simulationModule); _constantRipplesModule.SetDependencies(_mainModule, _meshModule, _simulationModule); _scriptGeneratedRipplesModule.SetDependencies(_mainModule, _meshModule, _simulationModule); _attachedComponentsModule.SetDependencies(_mainModule); _mainModule.Initialize(); _simulationModule.Initialize(); _meshModule.Initialize(); _materialModule.Initialize(); _renderingModule.Initialize(); _attachedComponentsModule.Initialize(); _constantRipplesModule.Initialze(); _animationModule.Initialze(); _areModulesInitialized = true; }
internal void SetDependencies(WaterMainModule mainModule, WaterMeshModule meshModule, WaterMaterialModule materialModule) { _mainModule = mainModule; _meshModule = meshModule; _materialModule = materialModule; }