public void CalculateSplashTargetsList(CalculateSplashTargetsWithCenterEvent evt, SplashWeaponNode weapon, [JoinByBattle] ICollection <ActiveTankNode> activeTanks) { SplashHitData splashHit = evt.SplashHit; HashSet <Entity> excludedEntityForSplashHit = splashHit.ExcludedEntityForSplashHit; foreach (ActiveTankNode node in activeTanks) { if ((excludedEntityForSplashHit == null) || !excludedEntityForSplashHit.Contains(node.Entity)) { ValidateSplashHitPointsEvent eventInstance = new ValidateSplashHitPointsEvent(splashHit, splashHit.ExclusionGameObjectForSplashRaycast); base.NewEvent(eventInstance).Attach(weapon).Attach(node).Schedule(); } } }
public void ValidateSplashHitTargetByWeaponPoint(ValidateSplashHitPointsEvent evt, SplashWeaponNode weaponHit, ActiveTankNode targetTank, [JoinByTank] SingleNode <TankIncarnationComponent> targetIncarnation, [JoinByTank] WeaponBoundsNode weaponBoundsTarget) { TankCollidersComponent tankColliders = targetTank.tankColliders; BoxCollider boundsCollider = tankColliders.BoundsCollider; float num = weaponBoundsTarget.weaponBounds.WeaponBounds.size.y * 0.5f; Vector3 position = targetTank.mountPoint.MountPoint.position; float radiusOfMinSplashDamage = weaponHit.splashWeapon.RadiusOfMinSplashDamage; SplashHitData splashHit = evt.SplashHit; Vector3 splashCenter = splashHit.SplashCenter; List <HitTarget> splashTargets = splashHit.SplashTargets; List <GameObject> exclusionGameObjectForSplashRaycast = splashHit.ExclusionGameObjectForSplashRaycast; List <GameObject> targetingColliders = tankColliders.TargetingColliders; Vector3 vector5 = targetTank.rigidbody.Rigidbody.position; Vector3 vector6 = vector5 - splashCenter; float num3 = boundsCollider.size.z * 0.25f; Vector3 vector8 = boundsCollider.transform.forward * num3; Vector3 center = boundsCollider.bounds.center; List <Vector3> list5 = new List <Vector3> { position + (boundsCollider.transform.up * num), center, center - vector8, center + vector8, position }; foreach (Vector3 vector12 in list5) { if (this.IsValidSplashPoint(targetTank, vector12, splashCenter, evt, radiusOfMinSplashDamage)) { HitTarget item = new HitTarget { Entity = targetTank.Entity, IncarnationEntity = targetIncarnation.Entity, LocalHitPoint = Vector3.zero, TargetPosition = vector5, HitDirection = vector6.normalized, HitDistance = vector6.magnitude }; splashTargets.Add(item); exclusionGameObjectForSplashRaycast.AddRange(targetingColliders); break; } } }
private bool IsValidSplashPoint(ActiveTankNode activeTank, Vector3 splashPositionForValidation, Vector3 splashCenter, ValidateSplashHitPointsEvent e, float radius) { if (!PhysicsUtil.ValidateVector3(splashCenter)) { return(false); } if (!PhysicsUtil.ValidateVector3(splashPositionForValidation)) { return(false); } using (new RaycastExclude(e.excludeObjects)) { return(((splashPositionForValidation - splashCenter).magnitude <= radius) ? !this.IsPointOccluded(activeTank, splashCenter, splashPositionForValidation) : false); } }