public void PrepareTargeting(TargetingEvent evt, TargetingNode verticalTargeting)
        {
            TargetingData targetingData          = evt.TargetingData;
            VerticalTargetingComponent component = verticalTargeting.verticalTargeting;
            MuzzleLogicAccessor        accessor  = new MuzzleLogicAccessor(verticalTargeting.muzzlePoint, verticalTargeting.weaponInstance);

            targetingData.Origin       = accessor.GetWorldPosition();
            targetingData.Dir          = accessor.GetFireDirectionWorld();
            targetingData.FullDistance = component.WorkDistance;
            targetingData.MaxAngle     = (component.AngleUp <= component.AngleDown) ? component.AngleDown : component.AngleUp;
            base.ScheduleEvent(BattleCache.collectDirectionsEvent.GetInstance().Init(targetingData), verticalTargeting);
            base.ScheduleEvent(BattleCache.collectTargetsEvent.GetInstance().Init(targetingData), verticalTargeting);
            base.ScheduleEvent(BattleCache.targetEvaluateEvent.GetInstance().Init(targetingData), verticalTargeting);
        }
Beispiel #2
0
        public void CollectDirections(CollectDirectionsEvent evt, VerticalTargetingNode verticalTargeting)
        {
            TargetingData targetingData          = evt.TargetingData;
            VerticalTargetingComponent component = verticalTargeting.verticalTargeting;

            CollectDirection(targetingData.Origin, targetingData.Dir, 0f, targetingData);
            Vector3 leftDirectionWorld = new MuzzleLogicAccessor(verticalTargeting.muzzlePoint, verticalTargeting.weaponInstance).GetLeftDirectionWorld();

            if (component.NumRaysUp > 0)
            {
                base.CollectSectorDirections(targetingData.Origin, targetingData.Dir, leftDirectionWorld, component.AngleUp / ((float)component.NumRaysUp), component.NumRaysUp, targetingData);
            }
            if (component.NumRaysDown > 0)
            {
                base.CollectSectorDirections(targetingData.Origin, targetingData.Dir, leftDirectionWorld, -component.AngleDown / ((float)component.NumRaysDown), component.NumRaysDown, targetingData);
            }
        }