Exemple #1
0
        private void HandleGateKill(KillResult kill, StargateLocation location)
        {
            var stargateLocations          = new[] { location };
            var existingGateCampByLocation =
                _gateCamps.FirstOrDefault(x => x.IsAtSameLocation(stargateLocations));

            if (existingGateCampByLocation == null)
            {
                HandleNewGateCamp(kill, location);
            }
            else
            {
                HandleExistingGateCamp(existingGateCampByLocation, kill, location);
            }
        }
Exemple #2
0
        private void CreateNewGateCamp(KillResult kill, StargateLocation location)
        {
            var killResults = new List <KillResult>
            {
                kill
            };
            var gateCampIndex = CalculateGateCampIndex(killResults);
            var gateCamp      = new GateCamp
            {
                GateCampIndex     = gateCampIndex,
                StargateLocations = new List <StargateLocation>

                {
                    location
                },
                Kills = killResults
            };

            _gateCamps.Add(gateCamp);
        }
Exemple #3
0
        public bool TryGetStargateLocation(int solarSystemID, Position pos, out StargateLocation location)
        {
            // ReSharper disable PossibleInvalidOperationException
            if (pos?.X == null)
            {
                location = null;
                return(false);
            }
            var posAsVector       = new Vector3((float)pos.X, (float)pos.Y, (float)pos.Z);
            var locationsOfSystem = _stargateLoations[solarSystemID];

            foreach (var curLocation in locationsOfSystem)
            {
                if (curLocation.IsInRange(posAsVector))
                {
                    location = curLocation;
                    return(true);
                }
            }

            location = null;
            return(false);
        }
Exemple #4
0
 private void HandleNewGateCamp(KillResult kill, StargateLocation location)
 {
     ChangePreviousGatecamps(kill);
     CreateNewGateCamp(kill, location);
 }
Exemple #5
0
 private void HandleExistingGateCamp(GateCamp existingGateCampByLocation, KillResult kill, StargateLocation location)
 {
     existingGateCampByLocation.Kills.Add(kill);
     if (!existingGateCampByLocation.StargateLocations.Contains(location))
     {
         existingGateCampByLocation.StargateLocations.Add(location);
     }
     existingGateCampByLocation.GateCampIndex = CalculateGateCampIndex(existingGateCampByLocation.Kills);
 }
 public bool TryGetStargateLocation(int solarSystemID, Position pos, out StargateLocation location)
 {
     location = _location;
     return(_returnValue);
 }
 public void SetNextStargateLocation(bool returnValue, StargateLocation location = null)
 {
     _returnValue = returnValue;
     _location    = location;
 }
Exemple #8
0
 public KillNode(KillResult kill, StargateLocation stargateLocation)
 {
     Kill             = kill;
     StargateLocation = stargateLocation;
 }