Exemple #1
0
    // Start is called before the first frame update
    void Start()
    {
        _grid = new Grid(shipOptionPrefab, this.transform.position, this.transform);
        foreach (ShipOption option in available)
        {
            if ((option.shipLocation.x + 1) > _grid.x || (option.shipLocation.y + 1) > _grid.y)
            {
                _grid.FillEmpty(option.shipLocation.x + 1, option.shipLocation.y + 1, lockSprite);
            }
            _grid.ChangeDisplaySprite(option.shipLocation.x, option.shipLocation.y, option.shipSprite);
        }

        _p1Selector = GameObject.Instantiate <CharacterSelector>(csPrefab, panel);
        _p2Selector = GameObject.Instantiate <CharacterSelector>(csPrefab, panel);

        if (available.Length >= 2)
        {
            _p1Selector.Init(_grid.GetSquare(available[0].shipLocation), panel);
            _p2Selector.Init(_grid.GetSquare(available[1].shipLocation), panel);
        }
    }