public void TestSearchDroidStorageCapacityIsTen()
        {
            // Arrange
            SearchDroidModel sdm = new SearchDroidModel();

            var result = 10;

            // Assert
            Assert.AreEqual(sdm.GetDroidStorageCapacity(), result);
        }
Esempio n. 2
0
    public void CreateItem()
    {
        int chance = Mathf.RoundToInt(Random.Range(0f, 5f)); // 20% chance

        GetDroidModel().SetDroidCurrentEnergy(GetDroidModel().GetDroidCurrentEnergy() - GetDroidModel().GetEnergyConsumption());

        if (chance == 1)
        {
            SearchDroidModel model = GetDroidModel() as SearchDroidModel;

            if (model.GetDroidStorageCapacity() > model.GetDroidStorage().Count)
            {
                int item = Mathf.RoundToInt(Random.Range(0f, 1f));
                model.GetDroidStorage().Add(ItemFactory.instance.CreateItem((ItemType)item));
            }
        }

        //update bay GUI, delegate should be better here
        GetDroidModel().GetCurrentDroidBay().GetDroidBayModel().GetDroidBayView().GetDroidEnergyText().text = GetDroidModel().GetDroidCurrentEnergy() + "/" + GetDroidModel().GetDroidMaxEnergy();
    }