Ejemplo n.º 1
0
        public void CalculateSplashCenterByStatic(CalculateSplashCenterByStaticHitEvent evt, SplashWeaponNode weapon)
        {
            SplashHitData splashHit = evt.SplashHit;
            StaticHit     staticHit = splashHit.StaticHit;

            splashHit.SplashCenter = staticHit.Position + (staticHit.Normal * 0.01f);
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
        public void FinalizeCalculationSplashCenter(CalculateSplashCenterEvent evt, Node node)
        {
            SplashHitData splashHit = evt.SplashHit;

            if (splashHit.SplashCenterInitialized)
            {
                base.ScheduleEvent(new CalculateSplashTargetsWithCenterEvent(splashHit), splashHit.WeaponHitEntity);
            }
        }
Ejemplo n.º 4
0
        public void PrepareHitByUnblockedWeapon(SendHitToServerIfNeedEvent evt, UnblockedWeaponNode weapon)
        {
            DirectionData bestDirection = evt.TargetingData.BestDirection;

            if (bestDirection.HasAnyHit())
            {
                SplashHitData splashHit = SplashHitData.CreateSplashHitData(HitTargetAdapter.Adapt(bestDirection.Targets), bestDirection.StaticHit, weapon.Entity);
                base.ScheduleEvent(new CollectSplashTargetsEvent(splashHit), weapon);
            }
        }
Ejemplo n.º 5
0
        public void PrepareSplashTargetsWhenBlockedWeapon(ShotPrepareEvent evt, BlockedWeaponNode weapon)
        {
            WeaponBlockedComponent weaponBlocked = weapon.weaponBlocked;
            StaticHit staticHit = new StaticHit {
                Position = weaponBlocked.BlockPoint,
                Normal   = weaponBlocked.BlockNormal
            };
            SplashHitData splashHit = SplashHitData.CreateSplashHitData(new List <HitTarget>(), staticHit, weapon.Entity);

            base.ScheduleEvent(new CollectSplashTargetsEvent(splashHit), weapon);
        }
Ejemplo n.º 6
0
        public void CalculateSplashCenterByTarget(CalculateSplashCenterByDirectTargetEvent evt, TankNode tank)
        {
            SplashHitData splashHit = evt.SplashHit;

            splashHit.SplashCenter = MathUtil.LocalPositionToWorldPosition(evt.DirectTargetLocalHitPoint, tank.rigidbody.Rigidbody.gameObject);
            HashSet <Entity> set = new HashSet <Entity> {
                tank.Entity
            };

            splashHit.ExcludedEntityForSplashHit = set;
            splashHit.ExclusionGameObjectForSplashRaycast.AddRange(tank.tankColliders.TargetingColliders);
        }
Ejemplo n.º 7
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();
                }
            }
        }
Ejemplo n.º 8
0
        public static void ExecuteSplashExplosion(Entity mine, Entity tank, Vector3 splashCenter)
        {
            StaticHit staticHit = new StaticHit {
                Normal   = Vector3.up,
                Position = splashCenter
            };
            SplashHitData    splashHit = SplashHitData.CreateSplashHitData(new List <HitTarget>(), staticHit, mine);
            HashSet <Entity> set       = new HashSet <Entity> {
                tank
            };

            splashHit.ExcludedEntityForSplashHit = set;
            EngineService.Engine.ScheduleEvent <SendTankMovementEvent>(tank);
            EngineService.Engine.ScheduleEvent(new CollectSplashTargetsEvent(splashHit), mine);
        }
Ejemplo n.º 9
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);
            }
        }
Ejemplo n.º 10
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;
                }
            }
        }
        public void CollectSplashTarget(StartSplashEffectEvent e, SplashEffectNode effect, [JoinByTank] SelfTankNode selfTank, [JoinByTeam] ICollection <RemoteTankNode> remoteTanks)
        {
            StaticHit staticHit = new StaticHit {
                Normal   = Vector3.up,
                Position = selfTank.rigidbody.Rigidbody.position + (this.SPLASH_CENTER_HEIGHT * (selfTank.rigidbody.Rigidbody.rotation * Vector3.up))
            };
            SplashHitData    splashHit = SplashHitData.CreateSplashHitData(new List <HitTarget>(), staticHit, effect.Entity);
            HashSet <Entity> set       = new HashSet <Entity> {
                selfTank.Entity
            };

            splashHit.ExcludedEntityForSplashHit = set;
            if (!effect.splashEffect.CanTargetTeammates)
            {
                foreach (RemoteTankNode node in remoteTanks)
                {
                    splashHit.ExcludedEntityForSplashHit.Add(node.Entity);
                }
            }
            base.ScheduleEvent <SendTankMovementEvent>(selfTank);
            base.ScheduleEvent(new CollectSplashTargetsEvent(splashHit), effect);
        }
 public CalculateSplashCenterByDirectTargetEvent(SplashHitData splashHit, Vector3 directTargetLocalHitPoint) : base(splashHit)
 {
     this.DirectTargetLocalHitPoint = directTargetLocalHitPoint;
 }
 public CalculateSplashCenterByStaticHitEvent(SplashHitData splashHit) : base(splashHit)
 {
 }
Ejemplo n.º 14
0
 public CollectSplashTargetsEvent(SplashHitData splashHit)
 {
     this.SplashHit = splashHit;
 }
 public ValidateSplashHitPointsEvent(SplashHitData splashHit, List <GameObject> excludeObjects)
 {
     this.SplashHit      = splashHit;
     this.excludeObjects = excludeObjects;
 }
 public CalculateSplashCenterEvent(SplashHitData splashHit)
 {
     this.SplashHit = splashHit;
 }