Пример #1
0
        public void SendHitEvent(CollectSplashTargetsEvent evt, SplashWeaponNode weapon)
        {
            SplashHitData      splashHit     = evt.SplashHit;
            SelfSplashHitEvent eventInstance = new SelfSplashHitEvent(splashHit.DirectTargets, splashHit.StaticHit, splashHit.SplashTargets);

            base.ScheduleEvent(eventInstance, weapon);
        }
Пример #2
0
 public void ScheduleHitFeedbackOnSelfSplashHitEvent(SelfSplashHitEvent e, SplashWeaponNode weapon, [JoinByTank] SelfTankNode tank, [JoinByBattle] BattleNode battle)
 {
     if (this.ValidateSelfHit(e, tank, battle))
     {
         base.ScheduleEvent <HitFeedbackEvent>(tank);
     }
     else if (((e.SplashTargets != null) && (e.SplashTargets.Count != 0)) && this.ValidateTargets(e.SplashTargets, tank, battle))
     {
         base.ScheduleEvent <HitFeedbackEvent>(tank);
     }
 }
Пример #3
0
        public void PrepareHit(CollectSplashTargetsEvent evt, SplashWeaponNode weapon)
        {
            SplashHitData    splashHit     = evt.SplashHit;
            List <HitTarget> directTargets = splashHit.DirectTargets;

            if (directTargets.Count <= 0)
            {
                base.ScheduleEvent(new CalculateSplashCenterByStaticHitEvent(splashHit), weapon.Entity);
            }
            else
            {
                HitTarget target = directTargets.First <HitTarget>();
                Entity    entity = target.Entity;
                base.ScheduleEvent(new CalculateSplashCenterByDirectTargetEvent(splashHit, target.LocalHitPoint), entity);
            }
        }
Пример #4
0
        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();
                }
            }
        }
Пример #5
0
        public void CalculateSplashCenterByStatic(CalculateSplashCenterByStaticHitEvent evt, SplashWeaponNode weapon)
        {
            SplashHitData splashHit = evt.SplashHit;
            StaticHit     staticHit = splashHit.StaticHit;

            splashHit.SplashCenter = staticHit.Position + (staticHit.Normal * 0.01f);
        }
Пример #6
0
        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;
                }
            }
        }