diff --git a/Behaviors/Radar.cs b/Behaviors/Radar.cs index 185b127..786ef0e 100644 --- a/Behaviors/Radar.cs +++ b/Behaviors/Radar.cs @@ -1,5 +1,5 @@ using System.Linq; -using System.Collections.Generic; +using C5; using UnityEngine; using UnitySteer; using UnitySteer.Helpers; @@ -24,9 +24,10 @@ public class Radar: MonoBehaviour, ITick { [SerializeField] LayerMask _layersChecked; + IList _detected; - List _vehicles = new List(); - List _obstacles = new List(); + IList _vehicles = new ArrayList(); + IList _obstacles = new ArrayList(); ObstacleFactory _obstacleFactory = null; @@ -51,7 +52,7 @@ public class Radar: MonoBehaviour, ITick { public IList Obstacles { get { ExecuteRadar(); - return _obstacles.AsReadOnly(); + return new GuardedList(_obstacles); } } @@ -80,7 +81,7 @@ public class Radar: MonoBehaviour, ITick { public IList Vehicles { get { ExecuteRadar(); - return _vehicles.AsReadOnly(); + return new GuardedList(_vehicles); } } @@ -154,7 +155,7 @@ void ExecuteRadar() protected virtual IList Detect() { - return new List(); + return new ArrayList(); } protected virtual void FilterDetected() diff --git a/Behaviors/RadarPing.cs b/Behaviors/RadarPing.cs index e7e7f33..01d0cd8 100644 --- a/Behaviors/RadarPing.cs +++ b/Behaviors/RadarPing.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using C5; using UnityEngine; using UnitySteer.Helpers; @@ -47,7 +47,8 @@ void OnDrawGizmos() protected override IList Detect() { var detected = Physics.OverlapSphere(Vehicle.Position, _detectionRadius, LayersChecked); - var list = new List(detected); + var list = new ArrayList(); + list.AddAll(detected); return list; } #endregion diff --git a/C5.meta b/C5.meta new file mode 100644 index 0000000..5c053f5 --- /dev/null +++ b/C5.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 1 +guid: a6f9e8bcc9e094c1d890bebb499ef21b diff --git a/C5/C5.dll b/C5/C5.dll new file mode 100644 index 0000000..2130d1f Binary files /dev/null and b/C5/C5.dll differ diff --git a/C5/C5.dll.meta b/C5/C5.dll.meta new file mode 100644 index 0000000..d93a77c --- /dev/null +++ b/C5/C5.dll.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 1 +guid: d63b4951b19c042b69d25334d31c5c2d diff --git a/C5/LICENSE.txt b/C5/LICENSE.txt new file mode 100644 index 0000000..90e8165 --- /dev/null +++ b/C5/LICENSE.txt @@ -0,0 +1,32 @@ +THE C5 GENERIC COLLECTION LIBRARY FOR C#/CLI + +Niels Kokholm and Peter Sestoft +IT University of Copenhagen, Denmark + +See http://www.itu.dk/research/c5/ +and http://www.itu.dk/research/c5/Release1.0/ITU-TR-2006-76.pdf + +-------------------------------------------- + +LICENSE + +Copyright (c) 2003-2007 Niels Kokholm and Peter Sestoft +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +-------------------------------------------- diff --git a/C5/LICENSE.txt.meta b/C5/LICENSE.txt.meta new file mode 100644 index 0000000..32cf726 --- /dev/null +++ b/C5/LICENSE.txt.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 1 +guid: cead7757b6cb148d383c3c190a0674c6