Example #1
0
        public void WorldData_ConfigurationTest()
        {
            CombatData someWorldData = new CombatData { Bullets = _someBullets, ShipList = _someShipList, Shockwaves = _someShockwaves, LevelSize = _aPoint};
            string[] someWorldConfig = someWorldData.Configuration;
            CombatData fromSomeConfig = new CombatData { Configuration = someWorldConfig };

            var fromConfigBullets = fromSomeConfig.Bullets;
            Assert.That(fromConfigBullets[0].OwnerName == _someBullets[0].OwnerName);
            Assert.That(fromConfigBullets[0].ShrapnelLevel == _someBullets[0].ShrapnelLevel);
            Assert.That(fromConfigBullets[1].Damage == _someBullets[1].Damage);
            Assert.That(fromConfigBullets[1].Lifetime == _someBullets[1].Lifetime);

            var fromConfigShipList = fromSomeConfig.ShipList;
            Assert.That(fromConfigShipList.Ships[0].PositionX == _someShipList.Ships[0].PositionX);
            Assert.That(fromConfigShipList.Ships[0].VelocityX == _someShipList.Ships[0].VelocityX);
            Assert.That(fromConfigShipList.Ships[1].IsDead    == _someShipList.Ships[1].IsDead);
            Assert.That(fromConfigShipList.Ships[1].VelocityY == _someShipList.Ships[1].VelocityY);

            var fromConfigShockwaves = fromSomeConfig.Shockwaves;
            Assert.That(fromConfigShockwaves[0].OwnerName == _someShockwaves[0].OwnerName);
            Assert.That(fromConfigShockwaves[0].PositionY == _someShockwaves[0].PositionY);
            Assert.That(fromConfigShockwaves[1].OwnerName == _someShockwaves[1].OwnerName);
            Assert.That(fromConfigShockwaves[1].Size == _someShockwaves[1].Size);

            var fromConfigLevelSize = fromSomeConfig.LevelSize;
            Assert.That(fromConfigLevelSize.X == _aPoint.X);
            Assert.That(fromConfigLevelSize.Y == _aPoint.Y);
        }
Example #2
0
 private void SendCombatData(bool overrideClient)
 {
     var combatData = new CombatData();
     combatData.ShipList = GetShipListFromPlayers(PlayerManager.Players);
     combatData.Bullets = ObjectManager.Bullets;
     combatData.Shockwaves = ObjectManager.Shockwaves;
     combatData.LevelSize = LevelSize;
     combatData.OverrideClient = overrideClient;
     _host.SendObjectTCP(combatData);
 }