Awperative Completely Reworked!
This commit is contained in:
19
Awperative/Kernel/Docker/Location.cs
Normal file
19
Awperative/Kernel/Docker/Location.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Awperative;
|
||||
|
||||
public abstract partial class Docker
|
||||
{
|
||||
public Behavior Get<Generic>() where Generic : Behavior => GetAll<Generic>()[0];
|
||||
public Behavior[] GetAll<Generic>() where Generic : Behavior {
|
||||
|
||||
List<Behavior> returnValue = [];
|
||||
foreach (Behavior component in _components)
|
||||
if (component is Generic) returnValue.Add(component);
|
||||
|
||||
if(returnValue.Count == 0) { Debug.LogWarning("Scene has no components of this type"); return null; }
|
||||
|
||||
return returnValue.ToArray();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user