mirror of
https://github.com/DerTyp7/industrialize-unity.git
synced 2025-10-30 21:07:11 +01:00
io
This commit is contained in:
@@ -8,15 +8,35 @@ public class IOPort : MonoBehaviour
|
|||||||
public int itemCount = 0;
|
public int itemCount = 0;
|
||||||
private int maxItemCount = 100;
|
private int maxItemCount = 100;
|
||||||
|
|
||||||
public void IncreaseItemCount(int value)
|
public int IncreaseItemCount(int value) // Returns rest of value
|
||||||
{
|
{
|
||||||
|
int restOfValue = 0;
|
||||||
}
|
if (itemCount + value > maxItemCount)
|
||||||
|
|
||||||
public void DecreaseItemCount(int value)
|
|
||||||
{
|
{
|
||||||
|
restOfValue = value - (maxItemCount - itemCount);
|
||||||
|
itemCount = maxItemCount;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
itemCount += value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return restOfValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int DecreaseItemCount(int value) // Returns rest of value
|
||||||
|
{
|
||||||
|
int restOfValue = 0;
|
||||||
|
if (itemCount - value < 0)
|
||||||
|
{
|
||||||
|
restOfValue = value - itemCount;
|
||||||
|
itemCount = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
itemCount -= value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return restOfValue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user