public void FreePools() { DDRed.FreePools(); DDYellow.FreePools(); DDWhite.FreePools(); DDBlue.FreePools(); ExplodeAnim.FreePools(); }
void InitWhite() { DDWhite.poolOn = new List <DDWhite>(); DDWhite.poolOff = new List <DDWhite>(); for (int i = 0; i < 64; ++i) { for (int j = 0; j < 64; ++j) { if (i % 4 == 0 && j % 4 == 0) { DDWhite white = DDWhite.CreateFromPool(); white.transform.localPosition = new Vector3(i * 16, j * 16, 0); wallsInit[j * 64 + i] = true; } } } }
static public DDWhite CreateFromPool() { DDWhite result = null; if (poolOff.Count == 0) { GameObject tmp = Instantiate <GameObject>(DDMapCreator.instance.squareReferences.whiteRef.gameObject); tmp.transform.SetParent(DDMapCreator.instance.transform); tmp.transform.localScale = Vector3.one; result = tmp.GetComponent <DDWhite>(); poolOn.Add(result); } else { result = poolOff[0]; poolOn.Add(result); poolOff.RemoveAt(0); } return(result); }