Пример #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;
            }
        }
Пример #2
0
 // State of field must be accessed via this method.
 public Correction Get(IntVector2 position)
 {
     if (FieldUpdated)
     {
         return(field.GetValue(position));
     }
     else
     {
         return(GetDefined(position)
                ?? CorrectionType.instance.Identity());
     }
 }