private void Awake() { _nav = GetComponent <CustNavigator>(); _register = FindObjectOfType <Register>(); _mood = GetComponent <CustomerMood>(); _animator = GetComponentInChildren <Animator>(); }
void FirstCustomer(CustomerMood customer) { if (!_customer) { RunTutorial(customer.transform, 3); _customer = true; } }
private void FirstAngry(CustomerMood customer) { if (!_angry) // only happens if it's our first time encountering it { RunTutorial(customer.transform, 0); _angry = true; } }
public void ChangeMood(CustomerMood customerMood) { mood = customerMood; if (mood == CustomerMood.Angry) { spriteRenderer.color = Color.red; } if (mood == CustomerMood.Satisfied) { spriteRenderer.color = Color.white; } }
private void SetMood(CustomerMood mood) { Mood = mood; switch (mood) { case CustomerMood.Happy: SetThoughtSprite(CustomerManager.Singleton.HappySprite); break; case CustomerMood.Sad: SetThoughtSprite(CustomerManager.Singleton.SadSprite); break; case CustomerMood.Neutral: SetThoughtSprite(CustomerManager.Singleton.NeutralSprite); break; } EnableThoughtBubble(); }
public void FirstAngry(CustomerMood customer) { onFirstAngry?.Invoke(customer); }
public void FirstCustomer(CustomerMood customer) { onFirstCustomer?.Invoke(customer); }
private MenuItem DecideKebabMenuChoice(KebabBuilding destinationKebabBuilding) { List<MenuItem> affordableMenuItemChoices = destinationKebabBuilding.kebabMenu.GetAffordableMenuItems(cash); if (affordableMenuItemChoices.Count == 0) { mood = CustomerMood.AngryNotEnoughCash; return null; } else return Utils.Random(affordableMenuItemChoices); }
private KebabBuilding DecideIfWantKebab() { int mostWantedScore = 0; KebabBuilding mostWantedKebabBuilding = null; foreach (KebabBuilding building in world.KebabBuildings) { double distance = MathUtils.Distance(x, z, building.tile.x, building.tile.z); int buildingWantScore = hunger + building.Reputation - Convert.ToInt32(distance); if (buildingWantScore >= mostWantedScore) { mostWantedScore = buildingWantScore; mostWantedKebabBuilding = building; } } if (mostWantedKebabBuilding != null) return mostWantedKebabBuilding; else { mood = CustomerMood.SkippingKebabToday; return null; } }
public void TriggerMaybeLeaveQueueOrBuyKebab() { KebabBuilding destinationKebabBuilding = (KebabBuilding)destinationBuilding; if (Time.time >= timeWhenLeavesQueue) { mood = CustomerMood.AngryToLongWaitTime; GoToMapEnd(); destinationKebabBuilding.ChangeReputation(-Settings.KebabBuilding_ReputationLostFromFull); if (!destinationKebabBuilding.customersInQueue.Remove(this)) throw new Exception("Did not remove customer from queue. Was not found."); } if (!destinationKebabBuilding.IsFull() && destinationKebabBuilding.customersInQueue.FirstOrDefault() == this) { BuyAndStartEating(); if (!destinationKebabBuilding.customersInQueue.Remove(this)) throw new Exception("Did not remove customer from queue. Was not found."); } }
public void TriggerArrivedAtKebabBuilding() { KebabBuilding destinationKebabBuilding = (KebabBuilding)destinationBuilding; menuItemWant = DecideKebabMenuChoice(destinationKebabBuilding); if (menuItemWant == null) { GoToMapEnd(); destinationKebabBuilding.ChangeReputation(-Settings.KebabBuilding_ReputationLostFromNoMenuItemDesiredOrAfforded); return; } else menuItemWantPriceWhenDecided = (int)menuItemWant.Price; if (destinationKebabBuilding.IsFull()) { if (!DecideIfJoinQueue(destinationKebabBuilding)) { mood = CustomerMood.AngryNoCapacity; GoToMapEnd(); destinationKebabBuilding.ChangeReputation(-Settings.KebabBuilding_ReputationLostFromFull); } } else BuyAndStartEating(); }
public void StopEating() { mood = CustomerMood.Normal; state = CustomerState.Nothing; hunger = 0; SetMoveSpeed(); KebabBuilding destinationKebabBuilding = (KebabBuilding)destinationBuilding; if (!destinationKebabBuilding.customers.Remove(this)) throw new Exception("Did not find customer in kebab building customer list when removing it."); DecideDestinationAndPath(); }
public void DecideDestinationAndPath() { if (state == CustomerState.Eating) throw new Exception("Should never decide new destination while eating."); mood = CustomerMood.Normal; if (hunger > 0) { destinationBuilding = DecideIfWantKebab(); if (destinationBuilding is KebabBuilding) GoToKebabBuilding((KebabBuilding)destinationBuilding); else GoToMapEnd(); } else { if (IsAtOrigin()) GoToMapEnd(); else GoToOrigin(); } }