public void coins(String coinS) { String[] temp = coinS.Split(':'); String[] cordintes = temp[1].Split(','); int cx, cy,clt, cv; cx = int.Parse(cordintes[0]); cy = int.Parse(cordintes[1]); clt = int.Parse(temp[2]); cv = int.Parse(temp[3]); CoinPile coinPile = new CoinPile(100, cx, cy, clt, cv,this); Battle.addObjects(coinPile, cx, cy); ///Battle.addCoins(coinPile); }
public void addCoins(CoinPile cp) { CoinPiles.Add(cp); }
public void removeCoinPile(CoinPile cp) { CoinPiles.Remove(cp); }
public void updatePlayer(String PData) { int px, py, direction, shot, health, coin, pointss,id; String[] playerData = PData.Split(';'); String[] cordinates = playerData[1].Split(','); id = int.Parse(playerData[0].ToCharArray()[1]+""); px = int.Parse(cordinates[0]); py = int.Parse(cordinates[1]); direction = int.Parse(playerData[2]); shot = int.Parse(playerData[3]); health = int.Parse(playerData[4]); coin = int.Parse(playerData[5]); pointss = int.Parse(playerData[6]); Player player = new Player(px, py, id, direction, shot.Equals(1), health, coin, pointss); if (shot.Equals(1)) { int size = 600 / Battle.getLength(); //DateTime t = DateTime.Now(); // Bullet b = new Bullet(1000, px, py, direction,DateTime.Now(),size); // Battle.addBullet(b); } if (health ==0) { if (!Battle.getShotPlayerList().Contains(id)) { CoinPile cpt = new CoinPile(100, px, py, 86400000, coin, this); Battle.addObjects(cpt, px, py); Battle.addPlayer(id); } } else { if (Battle.getObject(px, py) != null) { int t = Battle.getObject(px, py).getID(); if ((t == 100) || (t == 200)) { Battle.addObjects(null, px, py); } } } Battle.pdatePlayer(player, id); }
public void updateMap(String updateS) { //update map with the data recuieved starting with G String[] temp = updateS.Split(':'); for (int i = 1; i < 6; i++) { updatePlayer(temp[i]); } updateBrick(temp[6]); CoinPiles2 = Battle.getCoinList(); Lifepacks2 = Battle.getLifeList(); for (int k = 0; k < CoinPiles2.Count; k++) { CoinPiles2.ElementAt(k).reduceSeconds(); if (CoinPiles2.ElementAt(k).getSeconds() == 0) { tempCoin = CoinPiles2.ElementAt(k); Battle.addObjects(null, tempCoin.getX(), tempCoin.getY()); } } Battle.setCoinList(CoinPiles2); for (int k = 0; k < CoinPiles2.Count; k++) { Lifepacks2.ElementAt(k).reduceSeconds(); if (Lifepacks2.ElementAt(k).getSeconds() == 0) { tempLife = Lifepacks2.ElementAt(k); Battle.addObjects(null, tempLife.getX(), tempLife.getY()); } } Battle.setLifeList(Lifepacks2); }
public void removeCoinPiles(CoinPile cp, int x, int y) { Battle.addObjects(null, x, y); Battle.removeCoinPile(cp); }