public void TestCheckWhenResourceTypeChanged()
        {
            UnitStorage uStorage = new UnitStorage(40);

            uStorage.SetResourceType(ResourceType.Wood);
            uStorage.Gather(20);
            uStorage.SetResourceType(ResourceType.Metal);

            int actual = uStorage.getStorage();

            Assert.AreEqual(0, actual);
        }
        public void TestGetResourceType()
        {
            ResourceType expected = ResourceType.Metal;
            UnitStorage  uStorage = new UnitStorage(30);

            uStorage.SetResourceType(expected);

            ResourceType actual = uStorage.GetResourceType();

            Assert.AreEqual(expected, actual);
        }
Example #3
0
 public void GatherResource(ResourceType resourceType)
 {
     unitStorage.SetResourceType(resourceType);
     unitStorage.Gather(unitGatherAmount);
     animator.SetBool("working", true);
     if (unitStorage.checkFull())
     {
         Debug.Log("unit storage is full");
         animator.SetBool("working", false);
         DepositResource();
     }
 }