Exemplo n.º 1
0
    public GrandAlert [] CheckTime(System.DateTime t)
    {
        List <GrandAlert> fin = new List <GrandAlert>();

        int A = Age.Check(t);

        if (A > 0)
        {
            fin.Add(new GrandAlert(AlertType.Ageup, this, new int [1] {
                A
            }));
        }

        int F   = Fitness.Check(t);
        int soc = Social.Check(t);
        int H   = Hunger.Check(t);

        if (Hunger.Ratio < 0.2F)
        {
            fin.Add(new GrandAlert(AlertType.Hunger, this));
        }
        if (Fitness.Ratio < 0.2F)
        {
            fin.Add(new GrandAlert(AlertType.Fitness, this));
        }

        float agerate  = 1.0F + (float)Age.Value / 200.0F;
        float baserate = 0.05F * agerate;
        float multrate = 0.05F * agerate;

        float from_hunger  = multrate * Hunger.Ratio;
        float from_fitness = multrate * Fitness.Ratio;
        float from_social  = multrate * Social.Ratio;

        Smiles.Rate = baserate + (from_hunger + from_fitness + from_social);
        Grumps.Rate = baserate + (multrate - from_hunger) + (multrate - from_fitness) + (multrate - from_social);

        int S = Smiles.Check(t);
        int G = Grumps.Check(t);

        return(fin.ToArray());
    }