protected virtual void UpdateParticle(WeatherSystem weatherSystem) { float factor = 0; var location = weatherSystem.GetCameraLocation(out factor); var pos = weatherObject.transform.position; var cameraPos = weatherSystem.weatherCamera.transform.position; var cameraForward = weatherSystem.weatherCamera.transform.forward; if (location == PointLocation.OUT_RANGE) { Vector3 interectPoint; if (MathUtility.GetSimpleNearestInterectPoint(weatherSystem.influenceArea, cameraPos, weatherSystem.weatherCamera.transform.forward * 1000, out interectPoint)) { weatherSystem._edgePoint = interectPoint; cameraForward = (interectPoint - cameraPos).normalized; pos = new Vector3(interectPoint.x, cameraPos.y, interectPoint.z) + cameraForward * weatherSystem.particleOffset.z + Vector3.up * weatherSystem.particleOffset.y; } } else if (location == PointLocation.IN_RANGE) { #if UNITY_EDITOR Vector3 interectPoint; if (MathUtility.GetInterectPoint(weatherSystem.influenceArea, cameraPos, weatherSystem.weatherCamera.transform.forward * 1000, out interectPoint)) { weatherSystem._edgePoint = interectPoint; } #endif pos = cameraPos + cameraForward * weatherSystem.particleOffset.z + Vector3.up * weatherSystem.particleOffset.y; } else if (location == PointLocation.IN_EDGE) { Vector3 interectPoint; if (MathUtility.GetInterectPoint(weatherSystem.influenceArea, cameraPos, weatherSystem.weatherCamera.transform.forward * 1000, out interectPoint)) { weatherSystem._edgePoint = interectPoint; pos = new Vector3(interectPoint.x, cameraPos.y, interectPoint.z) - cameraForward * weatherSystem.particleOffset.z + Vector3.up * weatherSystem.particleOffset.y; } } weatherObject.transform.position = pos; }