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); } }
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); }
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); }
private void HandleNewGateCamp(KillResult kill, StargateLocation location) { ChangePreviousGatecamps(kill); CreateNewGateCamp(kill, location); }
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; }
public KillNode(KillResult kill, StargateLocation stargateLocation) { Kill = kill; StargateLocation = stargateLocation; }