示例#1
0
        public void setCoinPiles(String s)
        {
            String[] details = s.Split(':');
            if (details[0] == "C")
            {
                //set coin pile
                CoinPile coin = new CoinPile();


                //set position
                String[] b = details[1].Split(',');
                int      i = Convert.ToInt16(b[0]);
                int      j = Convert.ToInt16(b[1]);
                coin.setX(i);
                coin.setY(j);

                //set time
                int time = Convert.ToInt32(details[2]);
                coin.setTime(time);

                //set value
                int value = Convert.ToInt32(details[3]);
                coin.setValue(value);
                coin.started = true;
                coinpiles.Add(coin);
            }
        }
示例#2
0
 public Coin_GUI(CoinPile pile)
 {
     coi   = pile;
     value = pile.getValue();
     timeLeftToDisappear = (int)pile.getTime();
     position            = new Vector2(32 * pile.getX(), 32 * pile.getY());
     t          = new Timer();
     t.Interval = 1;
 }
示例#3
0
        public void Update(GameTime gametime, DataStorage ds, Player_GUI[] pl, List <Coin_GUI> co, List <Lifepack_GUI> li)
        {
            int damage, x, y;

            Brick[] br = ds.getBricks();
            for (int i = 0; i < br.Length; i++)
            {
                x      = br[i].getX();
                y      = br[i].getY();
                damage = br[i].getDamage();
                var brick = brickTiles.First(d => d.Rectangle.X == (x * size) && d.Rectangle.Y == (y * size));
                brick.setDamageLevel(damage);
            }

            Player[] playerDi = ds.getPlayers();
            for (int i = 0; i < playerDi.Length; i++)
            {
                pl[i].setValues(playerDi[i].getX(), playerDi[i].getY(), playerDi[i].getDirection(), playerDi[i].getHealth());
            }

            List <CoinPile> c = ds.getCoinPiles();

            for (int i = 0; i < c.Count; i++)
            {
                CoinPile cc = c.ElementAt(i);
                if (cc.disappeared == false || cc.isCollected == false)
                {
                    co.Add(new Coin_GUI(cc));
                }
            }

            List <LifePack> l = ds.getLifePacks();

            for (int i = 0; i < l.Count; i++)
            {
                LifePack ll = l.ElementAt(i);
                if (ll.disappeared == false || ll.isCollected == false)
                {
                    li.Add(new Lifepack_GUI(ll));
                }
            }
        }