public void Dispose() { if (WaterSediment != null) { WaterSediment.Dispose(); } WaterSediment = null; if (Velocity != null) { Velocity.Dispose(); } Velocity = null; if (VelocityBackBuffer != null) { VelocityBackBuffer.Dispose(); } VelocityBackBuffer = null; if (WaterSedimentBackBuffer != null) { WaterSedimentBackBuffer.Dispose(); } WaterSedimentBackBuffer = null; if (OutflowFlux != null) { OutflowFlux.Dispose(); } OutflowFlux = null; if (OutflowFluxBackBuffer != null) { OutflowFluxBackBuffer.Dispose(); } OutflowFluxBackBuffer = null; }
void Awake() { // // Init simulated variables // ------------------------------------------- for (int i = 0; i < N + 2; ++i) { _height[i] = new float[N + 2]; _flux[i] = new OutflowFlux[N + 2]; _source[i] = new float[N + 2]; _velocity[i] = new Velocity[N + 2]; _pigment[i] = new Color32[N + 2]; _sediment[i] = new float[N + 2]; _erosionDeposition[i] = new float[N + 2]; // temporary _tempLowerLayersHeight[i] = new float[N + 2]; _tempHeight[i] = new float[N + 2]; _tempSource[i] = new float[N + 2]; _tempFlux[i] = new OutflowFlux[N + 2]; _tempVelocity[i] = new Velocity[N + 2]; _tempPigment[i] = new Color32[N + 2]; _tempSediment[i] = new float[N + 2]; _tempErosionDeposition[i] = new float[N + 2]; } }