private void Start() { Application.runInBackground = true; Universe = new OSTData.Universe(0); Universe.Build(); PlayerCorp = Universe.CreateCorp(1); PlayerCorp.AddICU(200, "starting"); OSTData.Station city = Universe.GetStation(2); city.CreateHangar(PlayerCorp); OSTData.Station mine = Universe.GetStation(6); mine.CreateHangar(PlayerCorp); OSTData.Station reprocessing = Universe.GetStation(21); reprocessing.CreateHangar(PlayerCorp); OSTData.Ship ship = city.CreateShip(PlayerCorp); OSTData.ShipDestination dest = ship.AddDestination(city); dest.AddLoad(OSTData.ResourceElement.ResourceType.Wastes, 50); OSTData.ShipDestination dest2 = ship.AddDestination(mine); dest2.AddUnload(OSTData.ResourceElement.ResourceType.Wastes, 50); ship.Start(); OSTData.Ship ship2 = mine.CreateShip(PlayerCorp); OSTData.ShipDestination dest3 = ship2.AddDestination(reprocessing); dest3.AddUnload(OSTData.ResourceElement.ResourceType.Wastes, 100); OSTData.ShipDestination dest4 = ship2.AddDestination(mine); dest4.AddLoad(OSTData.ResourceElement.ResourceType.Wastes, 100); ship2.Start(); }
/// <summary> /// Ajouter une destination a la fin de la liste des destinatinos /// </summary> /// <param name="station"> La station de destination a ajouter</param> public ShipDestination AddDestination(Station station) { ShipDestination dest = new ShipDestination(this, station); _dest.Add(dest); onDestinationChange(); return(dest); }
/// <summary> /// Permet de supprimer une destination de la liste de destination. /// On ne peut pas supprimer la destination en cours. /// </summary> /// <param name="dest"> La destination a supprimer</param> public void RemoveDestination(ShipDestination dest) { int index = _dest.IndexOf(dest); if (index != -1 && index != _currentDest) { if (index < _currentDest) { _currentDest--; } _dest.RemoveAt(index); onDestinationChange(); } }
public void SetDestination(OSTData.ShipDestination dest) { _dest = dest; drop.value = _dest.Destination.ID - 1; foreach (OSTData.ShipDestination.LoadData l in _dest.Loads) { ShipLoadLine line = Instantiate <ShipLoadLine>(loadLinePrefab); line.transform.SetParent(loadsContent); line.Setdata(l); } foreach (OSTData.ShipDestination.LoadData l in _dest.Unloads) { ShipLoadLine line = Instantiate <ShipLoadLine>(loadLinePrefab); line.transform.SetParent(unloadsContent); line.Setdata(l); } }
/// <summary> /// Ajouter une destination a un index precis de la liste en cours. /// </summary> /// <param name="station"> La station de destination a ajouter</param> /// <param name="index"> L'index ou l'ajouter, 0 au debut</param> public ShipDestination AddDestination(Station station, int index) { if (index < 0) { return(null); } else if (index >= _dest.Count) { ShipDestination dest = new ShipDestination(this, station); _dest.Add(dest); onDestinationChange(); return(dest); } else { ShipDestination dest = new ShipDestination(this, station); _dest.Insert(index, dest); onDestinationChange(); return(dest); } }