Example #1
0
 private bool OutOfBorder(int i, int j)
 {
     if (i < 0 || i == helper.GetLength(0) || j < 0 || j == helper.GetLength(1))
     {
         return(true);
     }
     return(false);
 }
Example #2
0
    bool DisplayMap()
    {
        // Check for errors
        if (_cellArray == null && _cellArray.Length <= 0)
        {
            Debug.Log("[Error] " + this + ".DisplayMap() : _cellArray is corrupted.");
            return(false);
        }

        // Log

        // Prefab
        bool decalHexa = false;

        for (int x = 0; x < _cellArray.GetLength(0); x++)
        {
            for (int y = 0; y < _cellArray.GetLength(1); y++)
            {
                GameObject newHexa = Instantiate(_debug_hexaPrefab);
                newHexa.transform.position =
                    decalHexa ?
                    new Vector3(
                        x * (float)g_hexa * (float)_mapScale,
                        Random.Range(-.25f, .25f),
                        (y + 0.5f) * (float)_mapScale
                        ) :
                    new Vector3(
                        x * (float)g_hexa * (float)_mapScale,
                        Random.Range(-.25f, .25f),
                        (y) * (float)_mapScale
                        );
                newHexa.transform.localScale = ((Vector3.right + Vector3.up) * (float)_mapScale) + -Vector3.forward;
            }
            decalHexa = !decalHexa;
        }

        return(true);
    }