// Token: 0x060017D8 RID: 6104 RVA: 0x00067B08 File Offset: 0x00065D08 private static void PerformDamage(GameObject attacker, GameObject inflictor, float damage, bool isCrit, ProcChainMask procChainMask, float procCoefficient, DamageColorIndex damageColorIndex, DamageType damageType, Vector3 forceVector, float pushAwayForce, List <OverlapAttack.OverlapInfo> hitList) { for (int i = 0; i < hitList.Count; i++) { OverlapAttack.OverlapInfo overlapInfo = hitList[i]; if (overlapInfo.hurtBox) { HealthComponent healthComponent = overlapInfo.hurtBox.healthComponent; if (healthComponent) { DamageInfo damageInfo = new DamageInfo(); damageInfo.attacker = attacker; damageInfo.inflictor = inflictor; damageInfo.force = forceVector + pushAwayForce * overlapInfo.pushDirection; damageInfo.damage = damage; damageInfo.crit = isCrit; damageInfo.position = overlapInfo.hitPosition; damageInfo.procChainMask = procChainMask; damageInfo.procCoefficient = procCoefficient; damageInfo.damageColorIndex = damageColorIndex; damageInfo.damageType = damageType; damageInfo.ModifyDamageInfo(overlapInfo.hurtBox.damageModifier); healthComponent.TakeDamage(damageInfo); GlobalEventManager.instance.OnHitEnemy(damageInfo, healthComponent.gameObject); GlobalEventManager.instance.OnHitAll(damageInfo, healthComponent.gameObject); } } } }
// 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: 0x06000A0E RID: 2574 RVA: 0x00046974 File Offset: 0x00044B74 public void Fire() { Collider[] array = Physics.OverlapSphere(this.position, this.radius, LayerIndex.entityPrecise.mask); int num = array.Length; for (int i = 0; i < num; i++) { Collider collider = array[i]; HurtBox component = collider.GetComponent <HurtBox>(); if (component) { HealthComponent healthComponent = component.healthComponent; if (healthComponent && ((this.canHurtAttacker && healthComponent.gameObject == this.attacker) || healthComponent.GetComponent <TeamComponent>().teamIndex != this.teamIndex)) { BlastAttack.HitPoint hitPoint = default(BlastAttack.HitPoint); RaycastHit raycastHit = default(RaycastHit); hitPoint.hurtBox = component; Vector3 direction = collider.transform.position - this.position; if (direction.sqrMagnitude > 0f && collider.Raycast(new Ray(this.position, direction), out raycastHit, this.radius)) { hitPoint.hitPosition = raycastHit.point; hitPoint.hitNormal = raycastHit.normal; } else { hitPoint.hitPosition = collider.transform.position; hitPoint.hitNormal = this.position - hitPoint.hitPosition; } hitPoint.distanceSqr = (hitPoint.hitPosition - this.position).sqrMagnitude; if (!BlastAttack.bestHitPoints.ContainsKey(healthComponent) || BlastAttack.bestHitPoints[healthComponent].distanceSqr > hitPoint.distanceSqr) { BlastAttack.bestHitPoints[healthComponent] = hitPoint; } } } } BlastAttack.HitPoint[] array2 = new BlastAttack.HitPoint[BlastAttack.bestHitPoints.Count]; int num2 = 0; foreach (KeyValuePair <HealthComponent, BlastAttack.HitPoint> keyValuePair in BlastAttack.bestHitPoints) { array2[num2++] = keyValuePair.Value; } BlastAttack.bestHitPoints.Clear(); Array.Sort <BlastAttack.HitPoint>(array2, new Comparison <BlastAttack.HitPoint>(BlastAttack.HitPoint.DistanceSort)); foreach (BlastAttack.HitPoint hitPoint2 in array2) { float num3 = Mathf.Sqrt(hitPoint2.distanceSqr); float num4 = 0f; switch (this.falloffModel) { case BlastAttack.FalloffModel.None: num4 = 1f; break; case BlastAttack.FalloffModel.Linear: num4 = 1f - Mathf.Clamp01(num3 / this.radius); break; case BlastAttack.FalloffModel.SweetSpot: num4 = 1f - ((num3 > this.radius / 2f) ? 0.75f : 0f); break; } DamageInfo damageInfo = new DamageInfo(); damageInfo.attacker = this.attacker; damageInfo.inflictor = this.inflictor; damageInfo.damage = this.baseDamage * num4; damageInfo.crit = this.crit; damageInfo.force = this.bonusForce * num4 + this.baseForce * num4 * (hitPoint2.hitPosition - this.position).normalized; damageInfo.procChainMask = this.procChainMask; damageInfo.procCoefficient = this.procCoefficient; damageInfo.damageType = this.damageType; damageInfo.damageColorIndex = this.damageColorIndex; damageInfo.position = hitPoint2.hitPosition; damageInfo.ModifyDamageInfo(hitPoint2.hurtBox.damageModifier); hitPoint2.hurtBox.healthComponent.TakeDamage(damageInfo); GlobalEventManager.instance.OnHitEnemy(damageInfo, hitPoint2.hurtBox.healthComponent.gameObject); GlobalEventManager.instance.OnHitAll(damageInfo, hitPoint2.hurtBox.healthComponent.gameObject); } }