Esempio 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
        }
Esempio 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);
        }
Esempio 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);
        }
Esempio n. 4
0
        public override bool Execute(Tamagotchi tama, DateTime now)
        {
            if (tama.Health < HealthThreshold)
            {
                tama.IsAthletic = true;
            }
            else
            {
                tama.IsAthletic = false;
            }

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

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