예제 #1
0
 public Industry(SubStarBody parent, IndustryConstruction[] construction)
 {
     this.construction = construction == null ? new IndustryConstruction[0] : construction;
     this.parent       = parent;
     stats             = new IndustryStats();
     stats.CalculateStats(this);
 }
예제 #2
0
 public void SetSubStarBody(SubStarBody subStarBody)
 {
     this.subStarBody = subStarBody;
     ssoName.text     = subStarBody.name;
     parent           = frame.GetComponent <RectTransform>();
     Debug.Log(parent);
     CalcParams();
     Draw();
 }
예제 #3
0
파일: Hub.cs 프로젝트: yurisuser/Space
 public Hub(SubStarBody body)
 {
     if (body == null)
     {
         throw new System.Exception();
     }
     this.body     = body;
     this.storage  = AddStorage();
     this.industry = AddIndustry();
     this.market   = AddMarket();
     this.dock     = AddDock();
 }
예제 #4
0
    public static Storage CreateStorage(GoodsStack[] initGoods, SubStarBody body)
    {
        Storage storage = new Storage(body);

        if (initGoods != null)
        {
            for (int i = 0; i < initGoods.Length; i++)
            {
                storage.Add(initGoods[i]);
            }
        }
        return(storage);
    }
예제 #5
0
파일: Storage.cs 프로젝트: yurisuser/Space
 public void AddTestResources(SubStarBody body)
 {
     foreach (var construction in body.hub.industry.construction)
     {
         foreach (var item in construction.recipe.perTurn)
         {
             if (item.amount < 0)
             {
                 Add(new GoodsStack
                 {
                     id     = item.goodsId,
                     amount = (int)(item.amount * Settings.Industry.PROCESSING_RESERV_TURN * -1)
                 });;
             }
         }
     }
 }
예제 #6
0
    public static Industry TestCreateFullIndustry(SubStarBody body)
    {
        Industry industry = new Industry(body, null);
        List <IndustryConstruction> constructions = new List <IndustryConstruction>();

        if (body.resourcer == null)
        {
            industry.construction = new IndustryConstruction[] { CreateIndustryConstruction(null) };
            industry.stats.CalculateStats(industry);
            return(industry);
        }
        for (int i = 0; i < body.resourcer.resourceDeposits.Length; i++)
        {
            constructions.Add(CreateIndustryConstruction(body.resourcer.resourceDeposits[i]));
        }
        industry.construction = constructions.ToArray();
        industry.stats.CalculateStats(industry);
        return(industry);
    }
예제 #7
0
    private void Calculate(SubStarBody planet)
    {
        resources = new List <ResourceDeposit>();
        values    = new List <List <int> >();
        List <int> temp = new List <int>();

        for (int i = 0; i < planet.resourcer.resourceDeposits.Length; i++)
        {
            if (!resources.Exists(x => x.idResource == planet.resourcer.resourceDeposits[i].idResource))
            {
                resources.Add(planet.resourcer.resourceDeposits[i]);
                values.Add(new List <int> {
                    planet.resourcer.resourceDeposits[i].extraction
                });
                continue;
            }
            int index = resources.FindIndex(x => x.idResource == planet.resourcer.resourceDeposits[i].idResource);
            values[index].Add(planet.resourcer.resourceDeposits[i].extraction);
        }
        foreach (var item in values)
        {
            item.Sort((x, y) => y - x);
        }
    }
예제 #8
0
파일: Storage.cs 프로젝트: yurisuser/Space
 public Storage(SubStarBody body)
 {
     parent = body;
 }
예제 #9
0
 public static void Tick(SubStarBody station, IndustryConstruction module)
 {
     behav.Tick(new ManufactureWrapper {
         body = station, module = module
     });
 }
예제 #10
0
 public Resourcer(ResourceDeposit[] resourceDeposits, SubStarBody parent)
 {
     this.resourceDeposits = resourceDeposits == null ? new ResourceDeposit[0] : resourceDeposits;
     this.parent           = parent;
 }
예제 #11
0
 public void SetSubStarBody(SubStarBody body)
 {
     this.body   = body;
     header.text = body.name;
 }
예제 #12
0
 public void SetSSB(SubStarBody ssb)
 {
     this.ssb = ssb;
 }
예제 #13
0
 public void CreatePreview(SubStarBody planet, Transform parent)
 {
     Calculate(planet);
     Draw(parent.Find("res"));
 }
예제 #14
0
파일: Dock.cs 프로젝트: yurisuser/Space
 public Dock(SubStarBody parent)
 {
     this.parent = parent;
     dockedShips = new List <Ship>();
 }
예제 #15
0
 public Market(SubStarBody subStarBody)
 {
     parent = subStarBody;
 }
예제 #16
0
 public static Resourcer CreateResourcer(ResourceDeposit[] resourceDeposits, SubStarBody body)
 {
     return(new Resourcer(resourceDeposits, body));
 }
예제 #17
0
    public static Market CreateMarket(SubStarBody body)
    {
        Market market = new Market(body);

        return(market);
    }