示例#1
0
 // Use this for initialization
 void Start()
 {
     currentMode = 0;
     selectedAtt = new List <int>()
     {
         0, 0, 0
     };
     allUnits  = new List <ResUnit>();
     allGroups = new List <UnitGroup>();
     grid      = new UnitGrid();
 }
示例#2
0
文件: UIManager.cs 项目: rxpii/sv
 public void UpdateMarkers(List <VectorHex> posHighlighted)
 {
     foreach (GameObject tile in BoardManager.Instance.tiles)
     {
         TileBehavior tb        = tile.GetComponentInChildren <TileBehavior>();
         VectorHex    offsetPos = UnitGrid.OffsetForGrid(tb.posHex);
         GameObject   marker    = markerPool[offsetPos.q, offsetPos.r];
         if (posHighlighted.Contains(tb.posHex))
         {
             marker.GetComponentInChildren <Image>().color = Color.cyan;
         }
         else
         {
             marker.GetComponentInChildren <Image>().color = Color.grey;
         }
     }
 }
示例#3
0
文件: UIManager.cs 项目: rxpii/sv
    // Remove these initialization functions later. Reduce the coupling in these start function. Possibly handle them in a dedicated initialization script?
    public void Initialize()
    {
        markerPool = new GameObject[UnitGrid.GRID_DIM * 2 - 1, UnitGrid.GRID_DIM * 2 - 1];

        for (int i = 0; i < BoardManager.Instance.tiles.Count; i++)
        {
            GameObject tile = BoardManager.Instance.tiles[i];
            Debug.Log(tile);
            VectorHex  tilePos   = tile.GetComponentInChildren <TileBehavior>().posHex;
            VectorHex  offsetPos = UnitGrid.OffsetForGrid(tilePos);
            GameObject marker    = Instantiate(pf_Marker, transform);
            markerPool[offsetPos.q, offsetPos.r] = marker;
            marker.SetActive(true);
            marker.transform.position = new Vector3(tile.transform.position.x, 1.5f, tile.transform.position.z);
            marker.GetComponentInChildren <Image>().color = Color.grey;
            marker.GetComponentInChildren <Text>().text   = "" + tilePos.q + " " + tilePos.r;
        }
    }