Пример #1
0
    public void CalcurateSelling(Product product)
    {
        SaleReport saleReport  = new SaleReport();
        int        unitSelling = UnityEngine.Random.Range(10, 100000);
        int        price       = product.price;
        int        cost        = product.cost;
        int        income      = product.price * unitSelling;
        int        profit      = cost - income;
        int        fan         = (unitSelling / 100) * UnityEngine.Random.Range(1, 25);

        product.fan = fan;
        int allLevelComponent_temp = 0;

        foreach (ComponentData componentRequirements in product.genreDatas)
        {
            allLevelComponent_temp += componentRequirements.productLevel;
        }
        foreach (ComponentData componentRequirements in product.cameraDatas)
        {
            allLevelComponent_temp += componentRequirements.productLevel;
        }
        foreach (ComponentData componentRequirements in product.themeDatas)
        {
            allLevelComponent_temp += componentRequirements.productLevel;
        }
        foreach (ComponentData componentRequirements in product.graphicDatas)
        {
            allLevelComponent_temp += componentRequirements.productLevel;
        }
        foreach (ComponentData componentRequirements in product.featureDatas)
        {
            allLevelComponent_temp += componentRequirements.productLevel;
        }
        foreach (ComponentData componentRequirements in product.platformDatas)
        {
            allLevelComponent_temp += componentRequirements.productLevel;
        }

        product.income = allLevelComponent_temp * 10000;
        product.profit = allLevelComponent_temp * 10000;

        MessageSystem.instance.UpdateMessage("ได้รับเงินจาก Product[" + product.name + "] ในสัปดาห์นี้ " + allLevelComponent_temp * 10000 + " G");

        saleReport.Set(GameTimeStructure.instance.GetGameTimeStructure(), unitSelling, price, cost, income, profit, cost);
        product.timeStamp = GameTimeStructure.instance.GetFutureTime(1);
        product.AddSaleReport(saleReport);
    }