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 }
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); }
public override bool Execute(Tamagotchi tama, DateTime now) { if (tama.Sleep == SleepThreshold && !tama.IsAthletic) { tama.HasDied = true; } else { tama.HasDied = false; } return(true); }
public override bool Execute(Tamagotchi tama, DateTime now) { if (tama.Health < HealthThreshold) { tama.IsAthletic = true; } else { tama.IsAthletic = false; } return(true); }
public override bool Execute(Tamagotchi tama, DateTime now) { if (tama.Boredom > 80) { tama.HasMunchies = true; } else { tama.HasMunchies = false; } return(true); }
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); }
public virtual void Deactivate(Tamagotchi tama) /* do nothing */ }
/// <summary> /// Apply this Rule to a Tamagotchi /// </summary> public abstract bool Execute(Tamagotchi tama, DateTime now);
public override void Deactivate(Tamagotchi tama) { tama.IsAthletic = false; }
public override void Deactivate(Tamagotchi tama) { tama.HasMunchies = false; }
public override void Deactivate(Tamagotchi tama) { tama.IsCrazy = false; }