public void RemoveOldPiece() { Sc_Wall oldWall = pieces[0]; pieces.Remove(oldWall); Destroy(oldWall.gameObject); }
public void AddPiece() { Sc_Wall piece = (Sc_Wall)Instantiate(wallPrefab); piece.transform.SetParent(this.transform, false); Vector3 spawnPosition = Vector3.zero; if (pieces.Count == 0) { spawnPosition = wallStart.position; } else { spawnPosition = pieces[pieces.Count - 1].exitPoint.position; } piece.transform.position = spawnPosition; pieces.Add(piece); }