bool canMake(int Index) { int Money = Rc.Money - Units[Index].Money; int Oil = Rc.Oil - Units[Index].Oil; int Metal = Rc.Metal - Units[Index].Metal; if (Money >= 0 && Oil >= 0 && Metal >= 0) { Rc.Change(0, -Units[Index].Money); Rc.Change(1, -Units[Index].Oil); Rc.Change(2, -Units[Index].Metal); return(true); } else { return(false); } }
void Collect() { if (Money > 0) { Rc.Change(0, Money); Note(0, Money); } if (Oil > 0) { Rc.Change(1, Oil); Note(1, Oil); } if (Metal > 0) { Rc.Change(2, Metal); Note(2, Metal); } }