public TrialObject[] GetScratchedObjects() { return(Objects .Concat(Connectors.Values.ToList()) .ToList() .FindAll(x => (DateTime.Now - x.LastUsed).TotalSeconds < 10 ) .ToArray()); }
public Blip AddBlip() { // add all the lists together into one big ol' list. List <Entity> concat = Objects.Concat(Vehicles.Select(i => (Entity)i)).Concat(Peds).ToList(); // now we convert each of the objects to a collection of vector3's Vector3[] vectors = concat.Select(i => i.Position).ToArray(); Vector3 average = Vector3.Zero; for (int i = 0; i < vectors.Length; i++) { average += vectors[i]; } average /= vectors.Length; return(CurrentBlip = World.CreateBlip(average)); }
private Ray GenerateColouredRay(int currentDepth, Ray ray) { IObject lastObject = null; while (true) { if (currentDepth <= 0) { return(ray); } var minDistance = double.MaxValue; IObject minDistanceObject = null; foreach (var o in Objects.Concat(LightSources)) { var distance = o.Intersect(ray); if (distance == null || distance >= minDistance || Equals(o, lastObject)) { continue; } minDistance = distance.Value; minDistanceObject = o; } lastObject = minDistanceObject; switch (minDistanceObject) { case null: return(ray); case ILightSource lightSource: ray.Colour = lightSource.Surface.Colour; return(ray); default: currentDepth--; var point = ray.Get(minDistance); var intensity = GetIntensity(point); ray = minDistanceObject.Reflect(ray, intensity, point); break; } } }