Пример #1
0
 public void SetAllSpawnersSpawning(bool shouldSpawn)
 {
     foreach (GameObject spawnerObj in spawnerSet.GetSet())
     {
         PropSpawner spawnerComponent = spawnerObj.GetComponent <PropSpawner>();
         spawnerComponent.SetSpawning(shouldSpawn);
     }
 }
Пример #2
0
        private void SpawnProps()
        {
            PropSpawner    propSpawner = new PropSpawner();
            MapPropBuilder builder     = new TreeBuilder();

            for (int i = 0; i < 200; i++)
            {
                builder = new TreeBuilder();
                propSpawner.Construct(builder);
                Controls.Add(builder.Prop.Picture);
            }
            for (int i = 0; i < 200; i++)
            {
                builder = new MountainBuilder();
                propSpawner.Construct(builder);
                Controls.Add(builder.Prop.Picture);
            }
        }
Пример #3
0
        public void Construct_MethodBuildsProps_PropFieldsAreSet()
        {
            //arrange
            PropSpawner    propSpawner = new PropSpawner();
            MapPropBuilder builder1    = new TreeBuilder();
            MapPropBuilder builder2    = new MountainBuilder();
            MapPropBuilder builder3    = new MountainBuilder();

            //act
            propSpawner.Construct(builder1);
            propSpawner.Construct(builder2);
            //assert
            Assert.AreNotEqual(builder1.Prop.Picture.Location.X, 0);
            Assert.AreNotEqual(builder1.Prop.Picture.Location.Y, 0);
            Assert.AreNotEqual(builder1.Prop.Picture.Size.Width, 100);
            Assert.AreNotEqual(builder1.Prop.Picture.Size.Height, 50);
            Assert.IsNotNull(builder1.Prop.Picture.Image);

            Assert.AreNotEqual(builder2.Prop.Picture.Location.X, 0);
            Assert.AreNotEqual(builder2.Prop.Picture.Location.Y, 0);
            Assert.AreNotEqual(builder2.Prop.Picture.Size.Width, 100);
            Assert.AreNotEqual(builder2.Prop.Picture.Size.Height, 50);
            Assert.IsNotNull(builder2.Prop.Picture.Image);
        }