// Token: 0x0600042A RID: 1066 RVA: 0x00011082 File Offset: 0x0000F282 private bool ProcessHit(ref BulletAttack.BulletHit hitInfo) { if (this.sniper && hitInfo.damageModifier == HurtBox.DamageModifier.SniperTarget) { hitInfo.damageModifier = HurtBox.DamageModifier.Weak; } return(!this.filterCallback(ref hitInfo) || this.hitCallback(ref hitInfo)); }
// Token: 0x06000A39 RID: 2617 RVA: 0x00033214 File Offset: 0x00031414 private void InitBulletHitFromOriginHit(ref BulletAttack.BulletHit bulletHit, Vector3 direction, Collider hitCollider) { bulletHit.direction = direction; bulletHit.point = this.origin; bulletHit.surfaceNormal = -direction; bulletHit.distance = 0f; bulletHit.collider = hitCollider; HurtBox component = bulletHit.collider.GetComponent <HurtBox>(); bulletHit.entityObject = ((component && component.healthComponent) ? component.healthComponent.gameObject : bulletHit.collider.gameObject); bulletHit.damageModifier = (component ? component.damageModifier : HurtBox.DamageModifier.Normal); }
// Token: 0x06000A3A RID: 2618 RVA: 0x000332A8 File Offset: 0x000314A8 private void InitBulletHitFromRaycastHit(ref BulletAttack.BulletHit bulletHit, Vector3 origin, Vector3 direction, ref RaycastHit raycastHit) { bulletHit.direction = direction; bulletHit.point = raycastHit.point; bulletHit.surfaceNormal = raycastHit.normal; bulletHit.distance = raycastHit.distance; bulletHit.collider = raycastHit.collider; bulletHit.point = ((bulletHit.distance == 0f) ? origin : raycastHit.point); HurtBox component = bulletHit.collider.GetComponent <HurtBox>(); bulletHit.entityObject = ((component && component.healthComponent) ? component.healthComponent.gameObject : bulletHit.collider.gameObject); bulletHit.damageModifier = (component ? component.damageModifier : HurtBox.DamageModifier.Normal); }
// Token: 0x0600042B RID: 1067 RVA: 0x000110B8 File Offset: 0x0000F2B8 private GameObject ProcessHitList(List <BulletAttack.BulletHit> hits, ref Vector3 endPosition, List <GameObject> ignoreList) { int count = hits.Count; int[] array = new int[count]; for (int i = 0; i < count; i++) { array[i] = i; } for (int j = 0; j < count; j++) { float num = this.maxDistance; int num2 = j; for (int k = j; k < count; k++) { int index = array[k]; if (hits[index].distance < num) { num = hits[index].distance; num2 = k; } } GameObject entityObject = hits[array[num2]].entityObject; if (!ignoreList.Contains(entityObject)) { ignoreList.Add(entityObject); BulletAttack.BulletHit bulletHit = hits[array[num2]]; if (!this.ProcessHit(ref bulletHit)) { endPosition = hits[array[num2]].point; return(entityObject); } } array[num2] = array[j]; } return(null); }
// Token: 0x06000426 RID: 1062 RVA: 0x00010B54 File Offset: 0x0000ED54 public bool DefaultHitCallback(ref BulletAttack.BulletHit hitInfo) { bool result = false; if (hitInfo.collider) { result = ((1 << hitInfo.collider.gameObject.layer & this.stopperMask) == 0); } if (this.hitEffectPrefab) { EffectManager.SimpleImpactEffect(this.hitEffectPrefab, hitInfo.point, this.HitEffectNormal ? hitInfo.surfaceNormal : (-hitInfo.direction), true); } if (hitInfo.collider) { SurfaceDef objectSurfaceDef = SurfaceDefProvider.GetObjectSurfaceDef(hitInfo.collider, hitInfo.point); if (objectSurfaceDef && objectSurfaceDef.impactEffectPrefab) { EffectData effectData = new EffectData { origin = hitInfo.point, rotation = Quaternion.LookRotation(hitInfo.surfaceNormal), color = objectSurfaceDef.approximateColor, surfaceDefIndex = objectSurfaceDef.surfaceDefIndex }; EffectManager.SpawnEffect(objectSurfaceDef.impactEffectPrefab, effectData, true); } } if (this.isCrit) { EffectManager.SimpleImpactEffect(Resources.Load <GameObject>("Prefabs/Effects/ImpactEffects/Critspark"), hitInfo.point, this.HitEffectNormal ? hitInfo.surfaceNormal : (-hitInfo.direction), true); } GameObject entityObject = hitInfo.entityObject; if (entityObject) { float num = 1f; switch (this.falloffModel) { case BulletAttack.FalloffModel.None: num = 1f; break; case BulletAttack.FalloffModel.DefaultBullet: num = 0.5f + Mathf.Clamp01(Mathf.InverseLerp(60f, 25f, hitInfo.distance)) * 0.5f; break; case BulletAttack.FalloffModel.Buckshot: num = 0.25f + Mathf.Clamp01(Mathf.InverseLerp(25f, 7f, hitInfo.distance)) * 0.75f; break; } DamageInfo damageInfo = new DamageInfo(); damageInfo.damage = this.damage * num; damageInfo.crit = this.isCrit; damageInfo.attacker = this.owner; damageInfo.inflictor = this.weapon; damageInfo.position = hitInfo.point; damageInfo.force = hitInfo.direction * (this.force * num); damageInfo.procChainMask = this.procChainMask; damageInfo.procCoefficient = this.procCoefficient; damageInfo.damageType = this.damageType; damageInfo.damageColorIndex = this.damageColorIndex; damageInfo.ModifyDamageInfo(hitInfo.damageModifier); TeamIndex teamIndex = TeamIndex.Neutral; if (this.owner) { TeamComponent component = this.owner.GetComponent <TeamComponent>(); if (component) { teamIndex = component.teamIndex; } } TeamIndex teamIndex2 = TeamIndex.Neutral; TeamComponent component2 = hitInfo.entityObject.GetComponent <TeamComponent>(); if (component2) { teamIndex2 = component2.teamIndex; } bool flag = teamIndex == teamIndex2; HealthComponent healthComponent = null; if (!flag) { healthComponent = entityObject.GetComponent <HealthComponent>(); } if (NetworkServer.active) { if (healthComponent) { healthComponent.TakeDamage(damageInfo); GlobalEventManager.instance.OnHitEnemy(damageInfo, hitInfo.entityObject); } GlobalEventManager.instance.OnHitAll(damageInfo, hitInfo.entityObject); } else if (ClientScene.ready) { BulletAttack.messageWriter.StartMessage(53); BulletAttack.messageWriter.Write(entityObject); BulletAttack.messageWriter.Write(damageInfo); BulletAttack.messageWriter.Write(healthComponent != null); BulletAttack.messageWriter.FinishMessage(); ClientScene.readyConnection.SendWriter(BulletAttack.messageWriter, QosChannelIndex.defaultReliable.intVal); } } return(result); }
// Token: 0x0600042F RID: 1071 RVA: 0x000113A0 File Offset: 0x0000F5A0 private void FireSingle(Vector3 normal, int muzzleIndex) { float num = this.maxDistance; Vector3 vector = this.origin + normal * this.maxDistance; List <BulletAttack.BulletHit> list = new List <BulletAttack.BulletHit>(); bool flag = this.radius == 0f || this.smartCollision; bool flag2 = this.radius != 0f; HashSet <GameObject> hashSet = null; if (this.smartCollision) { hashSet = new HashSet <GameObject>(); } if (flag) { RaycastHit[] array = Physics.RaycastAll(this.origin, normal, num, this.hitMask, this.queryTriggerInteraction); for (int i = 0; i < array.Length; i++) { BulletAttack.BulletHit bulletHit = default(BulletAttack.BulletHit); this.InitBulletHitFromRaycastHit(ref bulletHit, this.origin, normal, ref array[i]); list.Add(bulletHit); if (this.smartCollision) { hashSet.Add(bulletHit.entityObject); } if (bulletHit.distance < num) { num = bulletHit.distance; } } } if (flag2) { LayerMask mask = this.hitMask; if (this.smartCollision) { mask &= ~LayerIndex.world.mask; } RaycastHit[] array2 = Physics.SphereCastAll(this.origin, this.radius, normal, num, mask, this.queryTriggerInteraction); for (int j = 0; j < array2.Length; j++) { BulletAttack.BulletHit bulletHit2 = default(BulletAttack.BulletHit); this.InitBulletHitFromRaycastHit(ref bulletHit2, this.origin, normal, ref array2[j]); if (!this.smartCollision || !hashSet.Contains(bulletHit2.entityObject)) { list.Add(bulletHit2); } } } this.ProcessHitList(list, ref vector, new List <GameObject>()); if (this.tracerEffectPrefab) { EffectData effectData = new EffectData { origin = vector, start = this.origin }; effectData.SetChildLocatorTransformReference(this.weapon, muzzleIndex); EffectManager.SpawnEffect(this.tracerEffectPrefab, effectData, true); } }
// Token: 0x06000427 RID: 1063 RVA: 0x00010EC8 File Offset: 0x0000F0C8 public bool DefaultFilterCallback(ref BulletAttack.BulletHit hitInfo) { HurtBox component = hitInfo.collider.GetComponent <HurtBox>(); return((!component || !component.healthComponent || !(component.healthComponent.gameObject == this.weapon)) && hitInfo.entityObject != this.weapon); }