public void Show(Tower.TowerModel towerModel, Action <Tower.TowerModel> onIconClick)
    {
        _towerModel  = towerModel;
        _onIconClick = onIconClick;

        gameObject.SetActive(true);

        _towerIcon.sprite = towerModel.Icon;
        _price.text       = towerModel.Price.ToString();
    }
Example #2
0
    public Tower GetTowerReady(Tower.TowerModel model)
    {
        var tower = TowerTypes[model];

        var createdTower = Instantiate(tower);

        createdTower.SetParameters(tower.Model, tower.Upgrades);

        _matrixMap.SetSelectedTower(createdTower);

        return(createdTower);
    }
Example #3
0
    public void Init(MatrixMap matrixMap)
    {
        _matrixMap = matrixMap;

        foreach (var towerData in _towersData.dataArray)
        {
            var tower = Resources.Load <Tower>("Towers/tower" + towerData.KEY);
            Assert.IsTrue(tower != null);

            var model = new Tower.TowerModel(tower, towerData.KEY, towerData.Main, towerData.Damage, towerData.Shootdistance,
                                             towerData.Firerate, towerData.Turnspeed, tower.IconSprite, towerData.Price, towerData.Upgradetowers);

            TowerTypes.Add(model, tower);
        }

        foreach (var type in TowerTypes)
        {
            type.Value.SetParameters(type.Key, TowerTypes.Select(x => x.Key).Where(x => type.Key.Upgrades.Contains(x.Id)).ToList());
        }
    }