Exemplo n.º 1
0
    // Create hexmap indicator attached to hexcell
    public void GenerateHexType(HexCell cell, HexType type)
    {
        cell.hexType = type;
        // hexTypes[x+mapWidth*z] = type;
        if (type != HexType.Plain)
        {
            HexTypeInfo gm = null;
            if (type == HexType.Forest)
            {
                gm = Instantiate(hexPrefab_forest);
            }
            else if (type == HexType.Swamp)
            {
                gm = Instantiate(hexPrefab_swamp);
            }
            else if (type == HexType.Mountain)
            {
                gm = Instantiate(hexPrefab_mountain);
            }
            else if (type == HexType.Stones)
            {
                gm = Instantiate(hexPrefab_stones);
            }

            /*else if (type==HexType.Thorns)
             *      gm = Instantiate(hexPrefab_thorns);*/

            if (gm != null)
            {
                gm.ChangeType(type);
                gm.gameObject.transform.SetParent(cell.transform);
                gm.gameObject.transform.localPosition = Vector3.zero;
            }
        }
    }
Exemplo n.º 2
0
 public void ClearHexType()
 {
     for (int i = 0; i < cells.Length; i++)
     {
         HexTypeInfo gm = cells[i].gameObject.GetComponentInChildren <HexTypeInfo>();
         if (gm != null)
         {
             GameObject.Destroy(gm.gameObject);
         }
     }
 }