Exemplo n.º 1
0
        public TamagotchiRule(Tamagotchi tama, Rule rule)
            : this()
        {
#pragma warning disable RECS0021 // Warns about calls to virtual member functions occuring in the constructor
            Tamagotchi = tama;
            Rule       = rule;
#pragma warning restore RECS0021 // Warns about calls to virtual member functions occuring in the constructor
        }
Exemplo n.º 2
0
        public override bool Execute(Tamagotchi tama, DateTime now)
        {
            var timeSpan = now - tama.LastAllRulesPassedUtc;

            if (timeSpan >= oneHour)
            {
                tama.Boredom += DeltaBoredom * (int)timeSpan.TotalHours;
                return(true);
            }

            return(false);
        }
Exemplo n.º 3
0
        public override bool Execute(Tamagotchi tama, DateTime now)
        {
            if (tama.Sleep == SleepThreshold && !tama.IsAthletic)
            {
                tama.HasDied = true;
            }
            else
            {
                tama.HasDied = false;
            }

            return(true);
        }
Exemplo n.º 4
0
        public override bool Execute(Tamagotchi tama, DateTime now)
        {
            if (tama.Health < HealthThreshold)
            {
                tama.IsAthletic = true;
            }
            else
            {
                tama.IsAthletic = false;
            }

            return(true);
        }
Exemplo n.º 5
0
        public override bool Execute(Tamagotchi tama, DateTime now)
        {
            if (tama.Boredom > 80)
            {
                tama.HasMunchies = true;
            }
            else
            {
                tama.HasMunchies = false;
            }

            return(true);
        }
Exemplo n.º 6
0
        public override bool Execute(Tamagotchi tama, DateTime now)
        {
            var timeSpan = now - tama.LastAllRulesPassedUtc;

            if (timeSpan >= oneHour)
            {
                int delta = DeltaHunger;

                if (tama.HasMunchies)
                {
                    delta *= 2;
                }

                tama.Hunger += delta * (int)timeSpan.TotalHours;

                return(true);
            }

            return(false);
        }
Exemplo n.º 7
0
 public virtual void Deactivate(Tamagotchi tama) /* do nothing */ }
Exemplo n.º 8
0
 /// <summary>
 /// Apply this Rule to a Tamagotchi
 /// </summary>
 public abstract bool Execute(Tamagotchi tama, DateTime now);
Exemplo n.º 9
0
 public override void Deactivate(Tamagotchi tama)
 {
     tama.IsAthletic = false;
 }
Exemplo n.º 10
0
 public override void Deactivate(Tamagotchi tama)
 {
     tama.HasMunchies = false;
 }
Exemplo n.º 11
0
 public override void Deactivate(Tamagotchi tama)
 {
     tama.IsCrazy = false;
 }