Ejemplo n.º 1
0
    public BoardColumn(int rows, float xPosition, float tileSize, PlanetsPool pool, Material[] materials)
    {
        prefabPool     = pool;
        this.rows      = rows;
        this.materials = materials;

        this.xPosition = xPosition;
        this.tileSize  = tileSize;

        planets = new List <Planet>(rows);

        audioManager = GameObject.Find("AudioManager").GetComponent <AudioManager>();
    }
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        // Initialize planet pool relative to number of cells
        planetsPool = (PlanetsPool)ScriptableObject.CreateInstance("PlanetsPool");
        planetsPool.Init(numberOfColumns * numberOfRows);

        // Important to call before column creation
        GetTileSize();

        // Create board columns
        columns = new List <BoardColumn>(numberOfColumns);

        for (int i = 0; i < numberOfColumns; i++)
        {
            BoardColumn boardColumn = new BoardColumn(numberOfRows, i * tileSize, tileSize, planetsPool, LoadMaterials());
            columns.Add(boardColumn);
        }

        // Start game and fill board!
        FillBoard();
    }