Esempio n. 1
0
 public void SleepButtonClicked()
 {
     if (BackgroundTasks.Tasks.IsScavenging)
     {
         snackbar.ShowSnackBar("You can't sleep because you are scavenging !");
     }
     else
     {
         Debug.Log("Going to bed ... zZzZ ");
         //throw new System.Exception("test exception CLickOnBed ");
         menuController.OpenMenu(bedPanel);
     }
 }
Esempio n. 2
0
    public void StartNewScavenging(double scavengeTime)
    {
        SwitchLightsOff();

        this.lastScavenging = new Scavenging();

        actualScavengingStep = 0;
        totalScavengingSteps = (int)(scavengeTime * 2);

        if (totalScavengingSteps == 0)
        {
            return;
        }

        Debug.Log("*****    START SCAVENGING    ************");

        this.scavengeTime = scavengeTime;


        StartScavenging = DateTime.Now;
        EndScavenging   = StartScavenging.AddSeconds(5 * scavengeTime);

        // Real implem : endTime = startTime.AddMinutes(scavengeTime);
        // Debug.Log("scavengeTime : " + scavengeTime);

        TimeSpan deltaT = (EndScavenging - StartScavenging);
        TimeSpan dt     = new TimeSpan(deltaT.Ticks / totalScavengingSteps);

        List <DateTime> stepsTime = new List <DateTime>();

        stepsTime.Add(StartScavenging);
        Debug.Log("Palier:");
        for (int i = 1; i <= totalScavengingSteps; i++)
        {
            DateTime palier = stepsTime[i - 1] + dt;
            Debug.Log(palier);
            stepsTime.Add(palier);
        }

        scavengingPalier = stepsTime;
        IsScavenging     = true;
        snackbarController.ShowSnackBar("You'll be back from scavening in " + deltaT.Minutes + "m:" + deltaT.Seconds + "s");
    }