public void Update()
        {
            if (hasGeneratedGrid == true)
            {
                PixelGrid closestGrid  = null;
                float     tempDistance = 10000;
                foreach (PixelGrid p in pixelGridArray)
                {
                    if (Vector3.Distance(p.centerVector, CharacterData.instance.gameObject.transform.position) < tempDistance)
                    {
                        tempDistance = Vector3.Distance(p.centerVector, CharacterData.instance.gameObject.transform.position);
                        closestGrid  = p;
                    }
                }

                if (activeGrid != closestGrid)
                {
                    activeGrid = closestGrid;
                }

                activeGrid.UpdateRun();

                if (doubleAct == true)
                {
                    secondaryGrid.UpdateRun();
                }
            }
        }
 public void ObtuseWorkAround(int i, PixelGrid p)
 {
     tempGrid = p;
     if (i == 1)
     {
         Invoke("ActiveGridStepUp", 0.0001f);
     }
     else
     {
         Invoke("ActiveGridStepUpNeighbors", 0.0001f);
     }
 }
 public void GeneratePixelGrids()
 {
     if (cycleCountX <= gridSize && cycleCountY <= gridSize)
     {
         PixelGrid pixelGrid = new PixelGrid();
         pixelGrid.pixelPrefab = pixelPrefab;
         pixelGrid.layerSize   = indivGridCoor;
         pixelGridArray.Add(pixelGrid);
         //pixelGrid.centerVector = new Vector3 (cycleCountX * (Manager.instance.pixelGridDimensions * 0.05f), cycleCountY * (Manager.instance.pixelGridDimensions * 0.05f));
         activeGrid = pixelGrid;
         pixelGrid.StartUp();
     }
 }
        public void ActivateSecondaryGrid(GameObject g)
        {
            if (hasGeneratedGrid == true)
            {
                PixelGrid closestGrid  = null;
                float     tempDistance = Vector3.Distance(activeGrid.centerVector, g.transform.position);
                foreach (PixelGrid p in pixelGridArray)
                {
                    if (Vector3.Distance(p.centerVector, g.transform.position) < tempDistance)
                    {
                        tempDistance = Vector3.Distance(p.centerVector, g.transform.position);
                        closestGrid  = p;
                    }
                }

                if (closestGrid != activeGrid && closestGrid != null)
                {
                    doubleAct     = true;
                    secondaryGrid = closestGrid;
                }
            }
        }