コード例 #1
0
 public Lifepack_GUI(LifePack life)
 {
     lif = life;
     timeLeftToDisappear = (int)life.getTime();
     position            = new Vector2(32 * life.getX(), 32 * life.getY());
     t          = new Timer();
     t.Interval = 1;
 }
コード例 #2
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));
                }
            }
        }
コード例 #3
0
        public void setLifePacks(String s)
        {
            String[] details = s.Split(':');
            if (details[0] == "L")
            {
                //set lifePack
                LifePack lifepack = new LifePack();

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

                //set time
                int time = Convert.ToInt32(details[2]);
                lifepack.setTime(time);
                lifepack.started = true;
                lifepacks.Add(lifepack);
            }
        }