// Token: 0x060033E4 RID: 13284 RVA: 0x00152031 File Offset: 0x00150431 public static EPhysicsMaterial getMaterial(Vector3 point, Transform transform, Collider collider) { if (WaterUtility.isPointUnderwater(point)) { return(EPhysicsMaterial.WATER_STATIC); } if (transform.CompareTag("Ground")) { return(PhysicsTool.checkMaterial(point)); } return(PhysicsTool.checkMaterial(collider)); }
// Token: 0x0600280E RID: 10254 RVA: 0x000F2934 File Offset: 0x000F0D34 public static Transform effect(ushort id, Vector3 point, Vector3 normal) { EffectAsset effectAsset = (EffectAsset)Assets.find(EAssetType.EFFECT, id); if (effectAsset == null) { return(null); } if (effectAsset.splatterTemperature != EPlayerTemperature.NONE) { Transform transform = new GameObject().transform; transform.name = "Temperature"; transform.parent = Level.effects; transform.position = point + Vector3.down * -2f; transform.localScale = Vector3.one * 6f; transform.gameObject.SetActive(false); transform.gameObject.AddComponent <TemperatureTrigger>().temperature = effectAsset.splatterTemperature; transform.gameObject.SetActive(true); UnityEngine.Object.Destroy(transform.gameObject, effectAsset.splatterLifetime - effectAsset.splatterLifetimeSpread); } if (Dedicator.isDedicated) { if (!effectAsset.spawnOnDedicatedServer) { return(null); } } else if (GraphicsSettings.effectQuality == EGraphicQuality.OFF && !effectAsset.splatterLiquid) { return(null); } Quaternion quaternion = Quaternion.LookRotation(normal); if (effectAsset.randomizeRotation) { quaternion *= Quaternion.Euler(0f, 0f, (float)UnityEngine.Random.Range(0, 360)); } Transform transform2 = EffectManager.pool.Instantiate(effectAsset.effect, point, quaternion).transform; transform2.name = id.ToString(); transform2.parent = Level.effects; if (effectAsset.splatter > 0 && (!effectAsset.gore || OptionsSettings.gore)) { for (int i = 0; i < (int)(effectAsset.splatter * ((effectAsset.splatterLiquid || !(Player.player != null) || Player.player.skills.boost != EPlayerBoost.SPLATTERIFIC) ? 1 : 8)); i++) { RaycastHit raycastHit; if (effectAsset.splatterLiquid) { float f = UnityEngine.Random.Range(0f, 6.28318548f); float num = UnityEngine.Random.Range(1f, 6f); Ray ray = new Ray(point + new Vector3(Mathf.Cos(f) * num, 0f, Mathf.Sin(f) * num), Vector3.down); int splatter = RayMasks.SPLATTER; LandscapeHoleUtility.raycastIgnoreLandscapeIfNecessary(ray, 8f, ref splatter); Physics.Raycast(ray, out raycastHit, 8f, splatter); } else { Ray ray2 = new Ray(point, -2f * normal + new Vector3(UnityEngine.Random.Range(-1f, 1f), UnityEngine.Random.Range(-1f, 1f), UnityEngine.Random.Range(-1f, 1f))); int splatter2 = RayMasks.SPLATTER; LandscapeHoleUtility.raycastIgnoreLandscapeIfNecessary(ray2, 8f, ref splatter2); Physics.Raycast(ray2, out raycastHit, 8f, splatter2); } if (raycastHit.transform != null) { EPhysicsMaterial material = DamageTool.getMaterial(raycastHit.point, raycastHit.transform, raycastHit.collider); if (!PhysicsTool.isMaterialDynamic(material)) { float num2 = UnityEngine.Random.Range(1f, 2f); Transform transform3 = EffectManager.pool.Instantiate(effectAsset.splatters[UnityEngine.Random.Range(0, effectAsset.splatters.Length)], raycastHit.point + raycastHit.normal * UnityEngine.Random.Range(0.04f, 0.06f), Quaternion.LookRotation(raycastHit.normal) * Quaternion.Euler(0f, 0f, (float)UnityEngine.Random.Range(0, 360))).transform; transform3.name = "Splatter"; transform3.parent = Level.effects; transform3.localScale = new Vector3(num2, num2, num2); transform3.gameObject.SetActive(true); if (effectAsset.splatterLifetime > 1.401298E-45f) { EffectManager.pool.Destroy(transform3.gameObject, effectAsset.splatterLifetime + UnityEngine.Random.Range(-effectAsset.splatterLifetimeSpread, effectAsset.splatterLifetimeSpread)); } else { EffectManager.pool.Destroy(transform3.gameObject, GraphicsSettings.effect); } } } } } if (effectAsset.gore) { transform2.GetComponent <ParticleSystem>().emission.enabled = OptionsSettings.gore; } if (!effectAsset.isStatic && transform2.GetComponent <AudioSource>() != null) { transform2.GetComponent <AudioSource>().pitch = UnityEngine.Random.Range(0.9f, 1.1f); } if (effectAsset.lifetime > 1.401298E-45f) { EffectManager.pool.Destroy(transform2.gameObject, effectAsset.lifetime + UnityEngine.Random.Range(-effectAsset.lifetimeSpread, effectAsset.lifetimeSpread)); } else { float num3 = 0f; MeshRenderer component = transform2.GetComponent <MeshRenderer>(); if (component == null) { ParticleSystem component2 = transform2.GetComponent <ParticleSystem>(); if (component2 != null) { if (component2.main.loop) { num3 = component2.main.startLifetime.constantMax; } else { num3 = component2.main.duration + component2.main.startLifetime.constantMax; } } AudioSource component3 = transform2.GetComponent <AudioSource>(); if (component3 != null && component3.clip != null && component3.clip.length > num3) { num3 = component3.clip.length; } } if (num3 < 1.401298E-45f) { num3 = GraphicsSettings.effect; } EffectManager.pool.Destroy(transform2.gameObject, num3); } if (effectAsset.blast > 0 && GraphicsSettings.blast && GraphicsSettings.renderMode == ERenderMode.DEFERRED) { EffectManager.effect(effectAsset.blast, point, new Vector3(UnityEngine.Random.Range(-0.1f, 0.1f), 1f, UnityEngine.Random.Range(-0.1f, 0.1f))); } return(transform2); }