예제 #1
0
 private void decodeCoins(string[] tokens)
 {
     CoinPile coin = new CoinPile(decodeXY(tokens[1])[0],int.Parse(tokens[2])/1000,int.Parse(tokens[3].TrimEnd(new char[] { '#' })),size);
     mainscn.CoinPiles.Add(coin);
 }
예제 #2
0
        private void decodeUpdate(string[] tokens)
        {
            int pcount=tokens.Length-2;
            if (mainscn.Tanks == null) { mainscn.Tanks = new Tank[5]; }

            for (int i = 1; i <= pcount; i++)
            {
                string[] player = tokens[i].Split(new char[] { ';' });
                Tank p;
                if (mainscn.Tanks[i - 1] == null)
                    p = mainscn.Tanks[i - 1] = new Tank(size);
                else p = mainscn.Tanks[i - 1];

                int dir = int.Parse(player[2]);
                p.update(player[0], decodeXY(player[1])[0], new Vector2((2 - dir) % 2, (dir - 1) % 2),
                    int.Parse(player[4]), int.Parse(player[5]), int.Parse(player[6]), player[3].Equals("1"));
                if (p.Health == 0 && !p.Dead)
                {
                    p.Dead = true;
                    CoinPile coinpile = new CoinPile(p.Position, 100, p.Coins, size);
                    mainscn.CoinPiles.Add(coinpile);
                }
            }

            Vector3[] brks = decodeXYZ(tokens[pcount+1], 4);
            for (int i = 0; i < brks.Length; i++)
                mainscn.Bricks[i].Damage = (int)brks[i].Z;

            updateCoinsLpacks();
        }