Exemple #1
0
    private void DrawTiles()
    {
        for (int x = 0; x < mapModel.Width; x++)
        {
            for (int y = 0; y < mapModel.Height; y++)
            {
                GameObject hex_go = Instantiate(
                    HexagonPrefab,
                    new Vector3(HexMapHelper.GetXPosition(x, y), -0.1f, HexMapHelper.GetZPosition(y)),
                    Quaternion.identity);

                hex_go.transform.SetParent(this.transform);
                hex_go.name = "Hex_" + x + "_" + y;
                hex_go.GetComponent <Hex>().SetModel(mapModel.Table[x][y]);
                // TODO: Quill needs to explain different optimization later...
                hex_go.isStatic = true;
            }
        }
    }
Exemple #2
0
 internal void SetModel(BuildingModel model)
 {
     transform.position = new Vector3(HexMapHelper.GetXPosition(model.X, model.Y), model.Altitude, HexMapHelper.GetZPosition(model.Y));
     model._State.Subscribe(_ => SetState(_)).AddTo(disposables);
 }