Beispiel #1
0
    // Use this for initialization
    void Start()
    {
        TileGridGenerator gen = new TileGridGenerator();

        map = gen.GenerateEmpty(width, height);

        tiles = new TileBehavior[width * height];
        for (int x = 0; x < width; x++)
        {
            for (int y = 0; y < height; y++)
            {
                GameObject   o  = (GameObject)Instantiate(tile);
                TileBehavior tb = (TileBehavior)o.GetComponent(typeof(TileBehavior));
                o.transform.parent   = this.transform;
                o.transform.position = new Vector2(x, y);
                tb.x = x;
                tb.y = y;
                tiles[y * width + x] = tb;
            }
        }
        Events.Listen("PlaceCell", placeCellDelegate);
    }
Beispiel #2
0
 private void Awake()
 {
     CodeControl.Message.AddListener <TilesRequestEvent>(OnTilesRequested);
     gridGenerator = new TileGridGenerator();
 }