Exemple #1
0
        void InitializePanels()
        {
            foreach (var panel in panelPool)
            {
                panel.Pooled = true;
                panel.gameObject.SetActive(false);
            }

            foreach (var coord in map.Grids())
            {
                Vector3    position = new Vector3(coord.x, 0, coord.y);
                FloatValue value    = map.GetValue(coord);

                float v     = (value == null) ? 0.5f : value.v + 0.5f;
                Color color = new Color(v, 0, 0);

                string text = v.ToString();
                if (text.Length > 4)
                {
                    text = text.Substring(0, 4);
                }

                Poolable panel = panelPool.Unpool();
                panel.gameObject.SetActive(true);

                panel.transform.position = position;
                panel.GetComponent <Renderer>().material.color = color;
                panel.GetComponentInChildren <TextMesh>().text = text;
            }
        }
Exemple #2
0
 // Must be enumerated through before the next frame.
 public IEnumerable <IntVector2> Grids()
 {
     return(field.Grids());
 }