private void giveDesires(Guest guest) { ushort cycles = 0; // Try a few times if the guest doesn't want any desires while (cycles++ < MAX_DECISION_CYCLES) { Desire foundDesire = giveDesireByAvailability(guest); if (foundDesire != null) { break; } // If we didn't get desires by availability, we will want something based on our stats. foundDesire = giveDesireByStats(guest); if (foundDesire != null) { break; } // TODO: Leave park } }
public void FollowDesire() { // If we have no desires, stop this method and go back if (Desires.Count == 0) { return; } Desire desireToFollow = Desires.Peek(); // Can't follow desire, because the park doesn't have it. // TODO: Lower excitement if (!desireToFollow.Object.IsAvailable()) { return; } // Actually take the desire from the list desireToFollow = Desires.Dequeue(); if (desireToFollow.Object is BuildableObject) { var buildableObject = desireToFollow.Object as BuildableObject; buildableObject.Consume(this); this.Wallet.SubtractFromBalance(buildableObject.EntryFee, "(Fulfilled) " + desireToFollow.Reason); } // TODO: Do something with the object (like become damaged, or use products in stock) //desireToFollow.Object. // TODO: Apply the rides' boost after riding the ride }
private void RefreshDesires() { Desire oldAction = this.CurrentDesire; // If there are no items in the desires collection, we just go idle if (Desires.Count == 0) { this.CurrentDesire = new Desire() { Reason = "Walking around aimlessly...", GainedAt = DateTime.Now, }; } else { // Set our new interest to the first item in the queue this.CurrentDesire = Desires.Peek(); } if (ActionChanged != null) { ActionChanged.Invoke(this, new ActionChangedEventArgs(oldAction.Reason, this.CurrentDesire.Reason)); } }
private Desire giveDesireByStats(Guest guest) { // Go through all stats and decide wether we have cravings. float cravings = 40; IDesirable desirable = null; ObjectSpecific objectSpecific = null; foreach (var stat in guest.CurrentStats) { // If we aren't craving this stat, continue to the next stat. if (stat.Value < cravings) { continue; } switch (stat.Type.UniqueId) { case "hunger": { desirable = (IDesirable)Marketplace.Instance.GetRandomBuyableObject(ObjectSpecific.Types.Food); //objectSpecific = break; } case "thirst": { desirable = (IDesirable)Marketplace.Instance.GetRandomBuyableObject(ObjectSpecific.Types.Drink); //objectSpecific = break; } case "excitement": { desirable = (IDesirable)Marketplace.Instance.GetRandomBuyableObject(ObjectSpecific.Types.Exciting); //objectSpecific = break; } } //if (desirable == null) //throw new NotImplementedException("Add implementation for this desire!"); // If we've come here we have a desirable. We only want 1 thing. break; } if (desirable == null) { return(null); } // If we desire something out of our stats, enqueue it on our desire list Desire desire = new Desire() { Object = desirable, Specific = objectSpecific }; // Show that this ride/shop doesn't exist yet = (Unavailable) // TODO: Change this to say something like "I would love to go on something more exciting than X" desire.Reason = string.Format("(Unavailable) " + desire.Object.GetRandomDesireReason(), desire.Object); guest.Desires.Enqueue(desire); return(desire); }