//metoda kupująca wagon private void buttonBuyWagon_Click(object sender, EventArgs e) { //warunek kupna wagonu: aktualna ilość złota >= 50 oraz gra nie może być zapauzowana if (money >= 50 && Counter % 2 == 0 && wagonUpgrade == 0) { //tworzenie obiektu klasy wagon Wagon wagon = new Wagon(); //dodanie do listy Wagons.Add(wagon); } if (wagonUpgrade == 1) { //tworzenie obiektu klasy UpgradedWagon UpgradedWagon upgradedWagon = new UpgradedWagon(); Wagons.Add(upgradedWagon); } if (wagonUpgrade == 2) { //tworzenie obiektu klasy MasterWagon MasterWagon masterWagon = new MasterWagon(); Wagons.Add(masterWagon); } //liczba elementów listy wagonów howManyWagons = Wagons.Count; //zmiana liczby wagonów wyświeltanych w textboxie textBoxHowManyWagons.Text = howManyWagons.ToString(); }
public bool UpdateWagon(Wagon wagon) { int index = Wagons.FindIndex(w => w.Id == wagon.Id); Wagons[index] = wagon; return(true); }
public void AddWagon(Animal animal) { Wagon wagon = new Wagon(); wagon.AddAnimal(animal); Wagons.Add(wagon); }
public void CheckWagonSearcher() { //If there are wagons check first if J is bigger or equal than the Wagons if (J >= Wagons.Count()) { //If j is bigger or equal rest J back to 0 J = 0; } }
public void Add(Wagon wagon) //Add a wagon to train { if (wagon != null) { Wagons.Add(wagon); } else { throw new ArgumentNullException("wagon"); } }
private Wagon FindNewWagon() { if (Wagons == null) { Wagons = new List <Wagon>(); } Wagon _newWagon = new Wagon(); Wagons.Add(_newWagon); return(_newWagon); }
public void CloseWagons() { WagonSpace = 0; CheckFlag = true; int wagonCount = Wagons.Count(); for (int i = 0; i < wagonCount; i++) { ClosedWagons.Add(Wagons[0]); Wagons.Remove(Wagons[0]); } }
public bool Remove(Wagon wagon) // remove wagon { if (wagon == null) { throw new ArgumentNullException("wagon"); } Wagon w = FindWagon(wagon.WagonNumber); if (w != null) { Wagons.Remove(w); //remove from list if (OnWagonUpdate != null) { OnWagonUpdate(this, w, false); } return(true); } return(false); }
public bool Add(Wagon wagon) //add wagon { if (wagon == null) { throw new ArgumentNullException("wagon"); } Wagon w = FindWagon(wagon.WagonNumber); if (w == null) { Wagons.Add(wagon); //add to list if (OnWagonUpdate != null) { OnWagonUpdate(this, wagon, true); } return(true); } return(false); }
public Train(Locomotive locomotive, List <Wagon> wagons) : this() { Locomotive = locomotive; Wagons.AddRange(wagons); }
public void WagonToevoegen(Wagon wagon) { Wagons.Add(wagon); }
public Station(string name, IEnumerable <Wagon> wagons, IEnumerable <Locomotive> locomotives) : this() { Name = name; Wagons.AddRange(wagons); Locomotives.AddRange(locomotives); }
public Wagon GetWagonbyId(long id) { Wagon wagon = Wagons.FirstOrDefault(w => w.Id == id); return(wagon); }
public long CreateWagon(Wagon wagon) { Wagons.Add(wagon); return(wagon.Id); }
public bool DeleteWagon(long id) { Wagons.FirstOrDefault(w => w.Id == id).Actief = false; return(true); }