Beispiel #1
0
        public static bool TryGetNearest(Vector2 position, out ResourcesSource source)
        {
            source = null;

            if (Sources.Count == 0)
            {
                return(false);
            }

            source = Sources.OrderBy(resourcesSource => Vector2.Distance(position, resourcesSource.transform.position))
                     .First();

            return(true);
        }
Beispiel #2
0
 internal static void RemoveSource(ResourcesSource source)
 {
     Sources.Remove(source);
 }
Beispiel #3
0
 internal static void AddSource(ResourcesSource source)
 {
     Sources.Add(source);
     OnResourcesCreated?.Invoke();
 }