public Sprite UnitSprite; // Mala slika od unita koja bude se prikazala kod multiple selektiranja public units(int x, string y, PlayerUnitScript z, Sprite a) { UnitID = x; UnitName = y; UnitRef = z; UnitSprite = a; }
public void RemoveUnit(int ID, string Name, PlayerUnitScript Ref, Sprite Spr) { //bool exists = false; for (int i = 0; i < 30; i++) { if (SelectedUnits[i].UnitID == ID && SelectedUnits[i].UnitName == Name) { SelectedUnits[i].UnitID= 0; SelectedUnits[i].UnitName= null; SelectedUnits[i].UnitRef = null; SelectedUnits[i].UnitSprite = null; //exists = true; break; } } /* if(!exists) Debug.Log("Nema takvog u listi.");*/ }
public bool AddUnit(int ID, string Name, PlayerUnitScript Ref, Sprite Spr) { for(int i= 0; i < 30; i++) { if(SelectedUnits[i].UnitID == 0) { SelectedUnits[i].UnitID = ID; SelectedUnits[i].UnitName = Name; SelectedUnits[i].UnitRef = Ref; SelectedUnits[i].UnitSprite = Spr; Debug.Log("Dodano!"); return true; } } Debug.Log("Nije dodano za " + ID); return false; }