Exemplo n.º 1
0
 public void Prepare()
 {
     SyncMessages = new List <ISyncEventArgs>();
     Scene        = SceneSamples.CreateSimpleScene(this.EventHandler, true);
     Scene.Actors.Find(x => SceneHelper.GetOrderByGuid(x.ExternalId) == 1).ChangePosition(Scene.Tiles[17][2], true);
     SyncMessages.Clear();
 }
Exemplo n.º 2
0
 public void Prepare()
 {
     SyncMessages = new List <ISyncEventArgs>();
     Scene        = SceneSamples.CreateSimpleScene(this.EventHandler, false);
     Scene.Actors.Find(x => SceneHelper.GetOrderByGuid(x.ExternalId) == 1).Kill();
     Scene.EndTurn();
     _decoration = Scene.CreateDecoration(Scene.Players.First(), "test_decoration", Scene.Tiles[4][4], null, null, null, null, null);
     SyncMessages.Clear();
 }
Exemplo n.º 3
0
        public void Death()
        {
            int i = 0;

            while (_effect.Duration > 0 && i < 100)
            {
                Scene.ActorWait();
            }

            Assert.That(i > 400, Is.False, "Cycle error");
            Assert.That((int)Scene.Actors.Find(x => SceneHelper.GetOrderByGuid(x.ExternalId) == 1).DamageModel.Health, Is.EqualTo(70), "Actor health after impact");
            Assert.That(_effect.Duration, Is.LessThanOrEqualTo(0), "Effect duration");
            Assert.That(_effect.IsAlive, Is.False, "Is alive");
            Assert.That(SyncMessages[SyncMessages.Count() - 1].SyncInfo.DeletedEffects.Count(), Is.EqualTo(1), "Count of deleted effects");
        }
Exemplo n.º 4
0
        public void CreateSynchronizer()
        {
            Scene = SceneSamples.CreateSimpleScene(this.EventHandler, false);
            Scene.Actors.Find(x => SceneHelper.GetOrderByGuid(x.ExternalId) == 1).ChangePosition(Scene.Tiles[17][2], true);
            Scene.CreateEffect(Scene.Players.First(), "test_effect", Scene.Tiles[1][2], null, null, 2, null);
            Scene.CreateDecoration(Scene.Players.First(), "test_decoration", Scene.Tiles[4][4], null, null, null, null, null);
            ISynchronizer synchronizer = new Synchronizer(
                Scene.TempTileObject,
                Scene.Players.ToList(),
                new List <Actor>()
            {
                Scene.Actors[0]
            },
                new List <ActiveDecoration>()
            {
                Scene.Decorations[0]
            },
                new List <SpecEffect>(),
                new List <Actor>()
            {
                Scene.Actors[1]
            },
                new List <ActiveDecoration>(),
                new List <SpecEffect>()
            {
                Scene.SpecEffects[0]
            },
                new ProjectArena.Engine.Helpers.Point(20, 20),
                new List <Tile>()
            {
                Scene.Tiles[4][4]
            },
                Scene.RandomCounter);

            Assert.That(synchronizer.TempActor, Is.EqualTo(Scene.TempTileObject.Id), "Temp tile actor");
            Assert.That(synchronizer.TempDecoration, Is.EqualTo(null), "No temp tile decoration");
            Assert.That(synchronizer.ChangedActors.ToArray()[0].Id, Is.EqualTo(Scene.Actors[0].Id), "Rigth actors");
            Assert.That(synchronizer.ChangedDecorations.ToArray()[0].Id, Is.EqualTo(Scene.Decorations[0].Id), "Rigth decorations");
            Assert.That(synchronizer.ChangedEffects.Count(), Is.EqualTo(0), "Rigth effects");
            Assert.That(synchronizer.DeletedActors.ToArray()[0], Is.EqualTo(Scene.Actors[1].Id), "Rigth deleted actors");
            Assert.That(synchronizer.DeletedDecorations.Count(), Is.EqualTo(0), "Rigth deleted decorations");
            Assert.That(synchronizer.DeletedEffects.ToArray()[0], Is.EqualTo(Scene.SpecEffects[0].Id), "Rigth deleted effects");
            Assert.That(synchronizer.ChangedTiles.ToArray()[0].X, Is.EqualTo(4), "Rigth tiles");
            Assert.That(synchronizer.ChangedTiles.ToArray()[0].Y, Is.EqualTo(4), "Rigth tiles");
        }
Exemplo n.º 5
0
 public void Impact()
 {
     Scene.ActorWait();
     Assert.That((int)Scene.Actors.Find(x => SceneHelper.GetOrderByGuid(x.ExternalId) == 1).DamageModel.Health, Is.EqualTo(95), "Actor health after impact");
     Assert.That(_effect.Duration, Is.LessThan(2), "Effect duration");
 }
Exemplo n.º 6
0
 public void StartState()
 {
     Assert.That(Scene.Tiles[1][2].TempObject, Is.Null, "Previous actor position");
     Assert.That(SceneHelper.GetOrderByGuid(((Actor)Scene.Tiles[17][2].TempObject).ExternalId), Is.EqualTo(1), "Previous actor position");
 }