From d03e3c1c05767757c6c5bf05783c6d7ccafe1de7 Mon Sep 17 00:00:00 2001 From: laurids Date: Sun, 28 Nov 2021 16:46:09 +0100 Subject: [PATCH] Performance: Cache Formation Zones --- Assets/GWConquest/Scripts/Zone.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Assets/GWConquest/Scripts/Zone.cs b/Assets/GWConquest/Scripts/Zone.cs index 750842f..22ce492 100644 --- a/Assets/GWConquest/Scripts/Zone.cs +++ b/Assets/GWConquest/Scripts/Zone.cs @@ -33,12 +33,14 @@ namespace GWConquest [SerializeField] private int zoneId; + private List formations = new List(); + public IEnumerable Formations { - //get => formations; - get { + get => formations; + /*get { return Formation.AllFormations.Where(f => f.State.CurrentZone == zoneId); - } + }*/ } private static Dictionary zoneDict = new Dictionary(); @@ -105,6 +107,8 @@ namespace GWConquest public void OnFormationArrived(Formation formation) { + formations.Add(formation); + OnFormationChanged(formation); if (BoltNetwork.IsServer) @@ -158,6 +162,7 @@ namespace GWConquest } } + formations.Remove(formation); } public void OnFormationChanged(Formation formation)