Esempio n. 1
0
        public GameInterface(GraphicsDevice device)
        {
            _screenHeight = device.Viewport.Height;

            _lifeBar = new ResizeBar(new Vector2(250, 650), @"Textures\lifebar", width: 300, maxLife: 400, life: 400);
            _waveBar = new ResizeBar(new Vector2(250, 680), @"Textures\wavebar", width: 300, maxLife: 300, life: 0);


            _towerIcons = new List <TowerIcon>();

            TowerIcon towerIconFire = new TowerIcon(new Vector2(10, 650), @"Textures\button-fire-tower", "fire");

            towerIconFire.Text = "Creer des tours de feu.";
            _towerIcons.Add(towerIconFire);

            TowerIcon towerIconEarth = new TowerIcon(new Vector2(60, 650), @"Textures\button-earth-tower", "earth");

            towerIconEarth.Text = "Creer des tours de terre.";
            _towerIcons.Add(towerIconEarth);

            TowerIcon towerIconWater = new TowerIcon(new Vector2(110, 650), @"Textures\button-water-tower", "water");

            towerIconWater.Text = "Creer des tours d'eau.";
            _towerIcons.Add(towerIconWater);

            TowerSelectedType = "fire";

            _towerInformationBox = new TowerInformationsBox();
        }
Esempio n. 2
0
    void Start()
    {
        towerIcons = new List <TowerIcon>();
        List <Tower> towers = GameState.instance.towers;

        foreach (Tower tower in towers)
        {
            TowerIcon icon = Instantiate(towerIconPrefab, content);
            icon.transform.localPosition = new Vector3(((icon.transform as RectTransform).rect.width + spacing) * towerIcons.Count, 0);

            icon.SetTower(tower);
            towerIcons.Add(icon);
        }
        //Spawn towers buttons
    }