예제 #1
0
        private SmartEntity TraverseSpiralToFindTarget(int radius, int centerX, int centerZ, TargetingController.TargetValidator validator, object caller)
        {
            List <SmartEntity> list = TargetingController.TraverseSpiralToFindTargets(radius, centerX, centerZ, validator, caller, true);

            if (list != null && list.Count > 0)
            {
                return(list[0]);
            }
            return(null);
        }
예제 #2
0
        private void ImpactSingleTarget(Bullet bullet, int effectiveDamagePercentage, bool fromSplash, bool fromBeam)
        {
            Service.Get <EventManager>().SendEvent(EventId.EntityHit, bullet);
            SmartEntity   target   = bullet.Target;
            TeamComponent teamComp = target.TeamComp;

            if (bullet.HealthFrag.Type == HealthType.Damaging && teamComp != null && teamComp.TeamType == bullet.OwnerTeam)
            {
                return;
            }
            if (bullet.HealthFrag.Type == HealthType.Healing)
            {
                if (teamComp != null && teamComp.TeamType != bullet.OwnerTeam)
                {
                    return;
                }
                TargetingController targetingController = Service.Get <TargetingController>();
                if (!targetingController.CanBeHealed(target, bullet.Owner))
                {
                    return;
                }
            }
            IHealthComponent healthComponent;

            if (target.TroopShieldComp != null && target.TroopShieldComp.IsActive())
            {
                healthComponent = target.TroopShieldHealthComp;
            }
            else
            {
                healthComponent = target.HealthComp;
            }
            if (healthComponent != null)
            {
                Service.Get <HealthController>().ApplyHealthFragment(healthComponent, bullet.HealthFrag, bullet.ProjectileType.DamageMultipliers, effectiveDamagePercentage, fromSplash, fromBeam, bullet.Owner);
                bool flag = fromBeam && bullet.IsBeamFirstHit(target);
                if (flag)
                {
                    Service.Get <EventManager>().SendEvent(EventId.EntityHitByBeam, bullet);
                }
                if (bullet.FlashTarget && !healthComponent.IsDead() && (!fromBeam | flag))
                {
                    this.entityFlasher.AddFlashing(target, 0.3f, 0f);
                }
            }
        }
예제 #3
0
 public void UpdateNearbyTroops(int radius, int centerX, int centerZ)
 {
     TargetingController.TraverseSpiralToFindTargets(radius, centerX, centerZ, new TargetingController.TargetValidator(this.IsAttackerThenFlag), null, false);
 }
예제 #4
0
 public unsafe static long $Invoke20(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(TargetingController.TraverseSpiralToFindTargets(*(int *)args, *(int *)(args + 1), *(int *)(args + 2), (TargetingController.TargetValidator)GCHandledObjects.GCHandleToObject(args[3]), GCHandledObjects.GCHandleToObject(args[4]), *(sbyte *)(args + 5) != 0)));
 }