using System.Collections; using System.Collections.Generic; using UnityEngine; namespace TcgEngine { /// /// Useful optimization tool, let you use arrays without instantiating new ones /// public class ListSwap { public List swap1 = new List(); public List swap2 = new List(); //Return any array public List Get() { swap1.Clear(); //Clear before using return swap1; } //Return the OTHER array (because skip is already in use) public List GetOther(List skip) { if (skip == swap1) { swap2.Clear(); //Clear before using return swap2; } swap1.Clear(); //Clear before using return swap1; } //Clear both public void Clear() { swap1.Clear(); swap2.Clear(); } } }