示例#1
0
    // Update is called once per frame
    void Update()
    {
        if (solution == OilSpillSolution.None)
        {
            return;
        }

        Timer timer = GameObject.Find("Timer").GetComponent <Timer>();

        double oilCleaned = timer.TimeElapsed.TotalSeconds * speed;

        OilSpillingController.Amount -= oilCleaned;
        if (OilSpillingController.Amount <= 0)
        {
            OilSpillingController.Amount = 0;
            if (solution == OilSpillSolution.Burn || solution == OilSpillSolution.Skimmers)
            {
                RestartTraffic();
            }
            solution = OilSpillSolution.None;
            RecoverTrafficSpeed();

            string content = string.Format("Oil has been cleaned up");
            GameObject.Find("NotificationSystem").GetComponent <NotificationSystem> ().Notify(NotificationType.Success, content);
        }

        double welfareChange = welfareImpact * oilCleaned;

        WelfareCounter.ReduceWelfare(welfareChange);
    }
示例#2
0
    public void LogOilCleaning(OilSpillSolution solution)
    {
        JSONClass details = new JSONClass();

        AddTimeInformation(details);
        details ["solution"] = solution.ToString();
        TheLogger.instance.TakeAction(1, details);
    }
示例#3
0
    public void Dispersant()
    {
        solution = OilSpillSolution.Dispersant;

        budgetCounter.SpendMoney(2000000);

        SetCleaningSpeed();

        double shipSpeedInDispersant = GameObject.Find("SceneSetting").GetComponent <SceneSetting> ().ShipSpeedInDispersantArea;

        SlowDownTraffic(shipSpeedInDispersant);

        DisableAllToggles();

        logger.LogOilCleaning(OilSpillSolution.Dispersant);
    }
示例#4
0
    public void Skimmers()
    {
        if (hasShipInOilArea())
        {
            notificationSystem.Notify(NotificationType.Warning,
                                      "Cannot use skimmers. There are one or more ships in the oil-polluted area");
            return;
        }

        StopTraffic();

        solution = OilSpillSolution.Skimmers;
        SetCleaningSpeed();
        budgetCounter.SpendMoney(3000000);

        DisableAllToggles();

        logger.LogOilCleaning(OilSpillSolution.Skimmers);
    }