public GameObject GetDecorationForWidth(int width, LXFMLDecoration.DecoPosition spot) { List <GameObject> decos = new List <GameObject>(); for (int i = 0; i < _decorations.Length; i++) { LXFMLDecoration deco = _decorations[i].GetComponent <LXFMLDecoration>(); if (deco.position == spot && deco.width <= width) { decos.Add(_decorations[i]); } } if (decos.Count == 0) { return(null); } return(decos[Random.Range(0, decos.Count)]); }
public GameObject GetDecorationForHeight(List <int> heights, LXFMLDecoration.DecoPosition spot) { List <GameObject> decos = new List <GameObject>(); for (int i = 0; i < _decorations.Length; i++) { LXFMLDecoration deco = _decorations[i].GetComponent <LXFMLDecoration>(); if (deco.position == spot) { for (int j = 0; j < heights.Count; j++) { if (deco.height == (float)heights[j]) { decos.Add(_decorations[i]); } } } } if (decos.Count == 0) { return(null); } return(decos[Random.Range(0, decos.Count)]); }