public ItemBoxData CreateRandomBox() { ItemBoxData box = null; int rand = UnityEngine.Random.Range(0, 3); switch (rand) { case 0: box = CreateBox1(); break; case 1: box = CreateBox2(); break; case 2: box = CreateBox3(); break; default: break; } if (box == null) { throw new NullReferenceException("Box is no."); } return(box); }
// For testing purposes only private ContainerData RandomCrate() { ContainerData data = new ContainerData(); for (int i = 0; i < Random.Range(3, 5); i++) { ItemBoxData box = new ItemBoxData(BoxType.Type1); for (int j = 0; j < Random.Range(3, 5); j++) { box.AddToBox(factory.CreateRandomItem()); } data.AddToBox(box); } return(data); }