Exemplo n.º 1
0
    public static void MakeTile(int x, int z) // remember to make Highlight g static later
    {
        float xPos;
        float zPos;

        xPos = x * horzDistance;
        zPos = z * vertDistance;
        if (x % 2 == 1)
        {
            zPos -= vertDistance * 0.5f;
        }
        GameObject g = (GameObject)GameObject.Instantiate(Resources.Load("prefabs/HexFab"), new Vector3(xPos, 0f, -zPos), Quaternion.Euler(0, 0, 0));

        Map[z, x] = g.gameObject.GetComponent <HexCell>();
        Map[z, x].SetCoord(x, z);
        g.transform.parent = gMap.transform;

        if (Map[z, x].R >= 2 && Map[z, x].R <= 3)
        {
            Highlights.HighlightGameObject(g, 2);
        }
        else if (Map[z, x].R >= map_radius - 4 && Map[z, x].R <= map_radius - 3)
        {
            Highlights.HighlightGameObject(g, 3);
        }
    }