Esempio n. 1
0
    private void AddHangar(OSTData.Hangar h)
    {
        HangarLineView line = Instantiate <HangarLineView>(linePrefab);

        line.transform.SetParent(content);
        line.SetHangar(h);
    }
Esempio n. 2
0
    public void CreateHangarView(OSTData.Hangar h)
    {
        HangarView newObj = Instantiate <HangarView>(hangarViewPrefab);
        Window     window = winSystem.NewWindow("HangarView", newObj.gameObject);

        window.Title = "Hangar " + h.Station.Name;
        newObj.SetHangar(h);
    }
Esempio n. 3
0
    private void UpdateView()
    {
        ClearHangars();

        if (null == _universe)
        {
            return;
        }
        foreach (OSTData.Station s in _universe.GetStations())
        {
            OSTData.Hangar h = s.GetHangar(1);//todo magic number
            if (null != h)
            {
                AddHangar(h);
            }
        }
    }
Esempio n. 4
0
        /// <summary>
        /// le vaisseau est en train de se charger dans la station. Il partira quand il aura fini de charger ce qu'il doit
        /// ou quand il sera plein.
        /// <param name="possibleLoad">nombre de m3 qu'on peut charger cette fois</param>
        /// </summary>
        /// <returns>le nombre de m3 charge</returns>
        private int Load(int possibleLoad)
        {
            int     qteLoaded = 0;
            Station station   = Ship.CurrentStation;

            if (null == station)
            {
                return(qteLoaded);
            }

            Hangar myHangarInStation = station.GetHangar(Ship.Owner.ID);

            if (null != myHangarInStation)
            {
                foreach (LoadData l in _loads)
                {
                    if (!_loaded.ContainsKey(l.type))
                    {
                        _loaded.Add(l.type, 0);
                    }
                    int present = myHangarInStation.GetResourceQte(l.type);
                    int toLoad  = Math.Min(present, l.qte - _loaded[l.type]);
                    toLoad = Math.Min(toLoad, possibleLoad);

                    Destination.InformLoading(Ship, l.type);
                    if (toLoad > 0)
                    {
                        Ship.Cargo.Add(myHangarInStation.GetStack(l.type, toLoad));
                        qteLoaded       += toLoad;
                        _loaded[l.type] += toLoad;
                        possibleLoad    -= toLoad;
                    }
                }
            }

            return(qteLoaded);
        }
Esempio n. 5
0
        /// <summary>
        /// le vaisseau decharge sa cargaison avant de pouvoir en charger.
        /// </summary>
        /// <param name="possibleUnload">nombre de m3 qu'on peut decharger cette fois</param>
        /// <returns>le nombre de m3 decharge</returns>
        private int Unload(int possibleUnload)
        {
            int     result  = 0;
            Station station = Ship.CurrentStation;

            if (null == station)
            {
                return(result);
            }

            int qteUnloaded = 0;

            Hangar myHangarInStation = station.GetHangar(Ship.Owner.ID);

            if (null != myHangarInStation)
            {
                foreach (LoadData l in _unloads)
                {
                    if (!_unloaded.ContainsKey(l.type))
                    {
                        _unloaded.Add(l.type, 0);
                    }
                    int present = Ship.Cargo.GetResourceQte(l.type);
                    int toLoad  = Math.Min(present, l.qte - _unloaded[l.type]);
                    toLoad = Math.Min(toLoad, possibleUnload);

                    if (toLoad > 0)
                    {
                        myHangarInStation.Add(Ship.Cargo.GetStack(l.type, toLoad));
                        qteUnloaded       += toLoad;
                        _unloaded[l.type] += toLoad;
                        possibleUnload    -= toLoad;
                    }
                }
            }
            return(qteUnloaded);
        }
 public void SetHangar(OSTData.Hangar h)
 {
     //        _hangar = h;
     _resourceHold.SetZone(h);
 }
Esempio n. 7
0
 public void SetHangar(OSTData.Hangar h)
 {
     _hangar          = h;
     stationName.text = h.Station.Name;
 }