void Start() { if (targetGlobalSnow == null) { targetGlobalSnow = GlobalSnow.instance; } }
void Update() { if (snow == null) { snow = GlobalSnow.instance; AddToExclusionList(); } this.layer = gameObject.layer; }
void OnCollisionStay(Collision collision) { GlobalSnow snow = GlobalSnow.instance; GameObject go = collision.gameObject; if (snow != null && go != null) { // Ensure this object is visible for the camera if (snow.snowCamera != null && (snow.snowCamera.cullingMask & (1 << go.layer)) == 0) { return; } // Check gameobject position change Vector3 collisionPoint = go.transform.position; SnowColliderInfo colliderInfo; if (collisionCache.TryGetValue(go, out colliderInfo)) { Vector3 oldPosition = colliderInfo.position; float diff = (collisionPoint - oldPosition).sqrMagnitude; if (diff < 0.1f) { return; } } SnowColliderInfo newColliderInfo; newColliderInfo.position = collisionPoint; GlobalSnowColliderExtraInfo ci = go.GetComponent <GlobalSnowColliderExtraInfo> (); if (ci != null) { newColliderInfo.markSize = ci.markSize; } else { newColliderInfo.markSize = -1; } collisionCache [go] = newColliderInfo; ContactPoint[] cps = collision.contacts; if (cps != null) { for (int k = 0; k < cps.Length && k < 5; k++) { ContactPoint cp = cps [k]; snow.MarkSnowAt(cp.point, newColliderInfo.markSize); } } } }
public override void OnInspectorGUI() { serializedObject.Update(); EditorGUILayout.PropertyField(receiveSnow); EditorGUILayout.PropertyField(blockSnow); if (serializedObject.ApplyModifiedProperties()) { GlobalSnow snow = GlobalSnow.instance; if (snow != null) { snow.RefreshExcludedObjects(); } } }
void OnEnable() { snow = GlobalSnow.instance; AddToExclusionList(); }
void OnEnable() { snow = GetComponent <GlobalSnow> (); }
void Start() { snow = GlobalSnow.instance; }
void OnEnable() { titleColor = EditorGUIUtility.isProSkin ? new Color(0.52f, 0.66f, 0.9f) : new Color(0.12f, 0.16f, 0.4f); for (int k = 0; k < expandSection.Length; k++) { expandSection[k] = EditorPrefs.GetBool(SECTION_PREFS + k, false); } _headerTexture = Resources.Load <Texture2D>("GlobalSnow_EditorHeader"); sun = serializedObject.FindProperty("_sun"); debugSnow = serializedObject.FindProperty("_debugSnow"); deferredCameraEvent = serializedObject.FindProperty("_deferredCameraEvent"); showSnowInSceneView = serializedObject.FindProperty("_showSnowInSceneView"); forceForwardRenderingPath = serializedObject.FindProperty("_forceForwardRenderingPath"); floatingPointNormalsBuffer = serializedObject.FindProperty("_floatingPointNormalsBuffer"); smoothness = serializedObject.FindProperty("_smoothness"); snowAmount = serializedObject.FindProperty("_snowAmount"); #if UNITY_5_5_OR_NEWER forceSPSR = serializedObject.FindProperty("_forceSPSR"); #endif updateSpeedTree = serializedObject.FindProperty("_updateSpeedTree"); speedTreeRemoveLeaves = serializedObject.FindProperty("_speedTreeRemoveLeaves"); fixMaterials = serializedObject.FindProperty("_fixMaterials"); opaqueCutout = serializedObject.FindProperty("_opaqueCutout"); defaultExclusionLayer = serializedObject.FindProperty("_defaultExclusionLayer"); layerMask = serializedObject.FindProperty("_layerMask"); excludedCastShadows = serializedObject.FindProperty("_excludedCastShadows"); zenithalMask = serializedObject.FindProperty("_zenithalMask"); minimumAltitude = serializedObject.FindProperty("_minimumAltitude"); altitudeScatter = serializedObject.FindProperty("_altitudeScatter"); snowTint = serializedObject.FindProperty("_snowTint"); altitudeBlending = serializedObject.FindProperty("_altitudeBlending"); minimumAltitudeVegetationOffset = serializedObject.FindProperty("_minimumAltitudeVegetationOffset"); distanceOptimization = serializedObject.FindProperty("_distanceOptimization"); detailDistance = serializedObject.FindProperty("_detailDistance"); distanceSnowColor = serializedObject.FindProperty("_distanceSnowColor"); distanceIgnoreNormals = serializedObject.FindProperty("_distanceIgnoreNormals"); distanceIgnoreCoverage = serializedObject.FindProperty("_distanceIgnoreCoverage"); distanceSlopeThreshold = serializedObject.FindProperty("_distanceSlopeThreshold"); smoothCoverage = serializedObject.FindProperty("_smoothCoverage"); coverageResolution = serializedObject.FindProperty("_coverageResolution"); coverageExtension = serializedObject.FindProperty("_coverageExtension"); coverageMask = serializedObject.FindProperty("_coverageMask"); coverageUpdateMethod = serializedObject.FindProperty("_coverageUpdateMethod"); groundCoverage = serializedObject.FindProperty("_groundCoverage"); coverageMaskTexture = serializedObject.FindProperty("_coverageMaskTexture"); coverageMaskWorldSize = serializedObject.FindProperty("_coverageMaskWorldSize"); coverageMaskWorldCenter = serializedObject.FindProperty("_coverageMaskWorldCenter"); slopeThreshold = serializedObject.FindProperty("_slopeThreshold"); slopeSharpness = serializedObject.FindProperty("_slopeSharpness"); slopeNoise = serializedObject.FindProperty("_slopeNoise"); snowQuality = serializedObject.FindProperty("_snowQuality"); reliefAmount = serializedObject.FindProperty("_reliefAmount"); occlusion = serializedObject.FindProperty("_occlusion"); occlusionIntensity = serializedObject.FindProperty("_occlusionIntensity"); glitterStrength = serializedObject.FindProperty("_glitterStrength"); characterController = serializedObject.FindProperty("_characterController"); footprints = serializedObject.FindProperty("_footprints"); footprintsDuration = serializedObject.FindProperty("_footprintsDuration"); footprintsAutoFPS = serializedObject.FindProperty("_footprintsAutoFPS"); footprintsScale = serializedObject.FindProperty("_footprintsScale"); footprintsObscurance = serializedObject.FindProperty("_footprintsObscurance"); terrainMarks = serializedObject.FindProperty("_terrainMarks"); terrainMarksDuration = serializedObject.FindProperty("_terrainMarksDuration"); terrainMarksDefaultSize = serializedObject.FindProperty("_terrainMarksDefaultSize"); terrainMarksAutoFPS = serializedObject.FindProperty("_terrainMarksAutoFPS"); terrainMarksViewDistance = serializedObject.FindProperty("_terrainMarksViewDistance"); snowfall = serializedObject.FindProperty("_snowfall"); snowfallIntensity = serializedObject.FindProperty("_snowfallIntensity"); snowfallUseIllumination = serializedObject.FindProperty("_snowfallUseIllumination"); snowfallReceiveShadows = serializedObject.FindProperty("_snowfallReceiveShadows"); maxExposure = serializedObject.FindProperty("_maxExposure"); cameraFrost = serializedObject.FindProperty("_cameraFrost"); cameraFrostIntensity = serializedObject.FindProperty("_cameraFrostIntensity"); cameraFrostSpread = serializedObject.FindProperty("_cameraFrostSpread"); terrainMarksTextureSize = serializedObject.FindProperty("terrainMarksTextureSize"); billboardCoverage = serializedObject.FindProperty("_billboardCoverage"); grassCoverage = serializedObject.FindProperty("_grassCoverage"); enableHotKeys = serializedObject.FindProperty("_enableHotKeys"); enableWMAPI = serializedObject.FindProperty("_enableWMAPI"); maskEditorEnabled = serializedObject.FindProperty("_maskEditorEnabled"); maskTextureResolution = serializedObject.FindProperty("_maskTextureResolution"); maskBrushMode = serializedObject.FindProperty("_maskBrushMode"); maskBrushWidth = serializedObject.FindProperty("_maskBrushWidth"); maskBrushFuzziness = serializedObject.FindProperty("_maskBrushFuzziness"); maskBrushOpacity = serializedObject.FindProperty("_maskBrushOpacity"); gs = (GlobalSnow)target; }