public static GameAction GetRandomOrder(Entity entity, int orderTimeOurInMins = 120) { var randomValue = Random.value; if (randomValue <= 0.20) { var drinkOrder = new ExactDrinkorder(DrinkRecipes.GetRandomDrinkRecipe(), entity.GetState <NameState>().Name); return(OrderDrink(entity, drinkOrder, DialogueSelector.GetExactDrinkOrderConversation(drinkOrder.Recipe.DrinkName, entity), orderTimeoutInMins: orderTimeOurInMins)); } if (randomValue <= 0.40) { return(OrderDrink(entity, new NonAlcoholicDrinkOrder(entity.GetState <NameState>().Name), new OrderNonAlcoholicDrinkConversation(), orderTimeoutInMins: orderTimeOurInMins)); } if (randomValue <= 0.60) { var ingredient = Ingredients.DispensedIngredients.PickRandom(); return(OrderDrink(entity, new IncludingIngredientOrder(ingredient, entity.GetState <NameState>().Name), new OrderDrinkIncludingIngredientConversation(ingredient), orderTimeoutInMins: orderTimeOurInMins)); } if (randomValue <= 0.80) { var ingredient = Ingredients.DispensedIngredients.PickRandom(); return(OrderDrink(entity, new ExcludingIngredientOrder(ingredient, entity.GetState <NameState>().Name), new OrderDrinkExcludingIngredientConversation(ingredient), orderTimeoutInMins: orderTimeOurInMins)); } return(OrderDrink(entity, new ExactDrinkorder(DrinkRecipes.Beer, entity.GetState <NameState>().Name), DialogueSelector.GetExactDrinkOrderConversation("Beer", entity), orderTimeoutInMins: orderTimeOurInMins)); }
public static void TolstoyRomantic(Entity main, Entity other, out ActionSequence mainActionSequence, out ActionSequence otherActionSequence) { mainActionSequence = new ActionSequence("TolstoyRomanticOneMain"); otherActionSequence = new ActionSequence("TolstoyRomanticOneOther"); var ordering = CommonActions.GoToPaypointAndOrderDrink(main, DrinkRecipes.GetRandomDrinkRecipe()); mainActionSequence.Add(ordering); var talkToPlayer = CommonActions.TalkToPlayer(new TolstoyOneDialogue()); mainActionSequence.Add(talkToPlayer); otherActionSequence.Add(CommonActions.Wander()); var sync = new SyncedAction(main, other); mainActionSequence.Add(sync); otherActionSequence.Add(sync); mainActionSequence.Add(new SetTargetEntityAction(other)); mainActionSequence.Add(new GoToMovingEntityAction()); otherActionSequence.Add(new SetTargetEntityAction(main)); otherActionSequence.Add(new GoToMovingEntityAction()); var sync2 = new SyncedAction(main, other); mainActionSequence.Add(sync2); otherActionSequence.Add(sync2); var branchingDialogue = new DialogueBranchAction( new Dictionary <DialogueOutcome, Action> { { DialogueOutcome.Romantic, () => { ActionManagerSystem.Instance.AddActionToFrontOfQueueForEntity(main, new UpdateMoodAction(Mood.Happy)); } }, { DialogueOutcome.Mean, () => { ActionManagerSystem.Instance.AddActionToFrontOfQueueForEntity(main, new UpdateMoodAction(Mood.Angry)); } }, { DialogueOutcome.Nice, () => { ActionManagerSystem.Instance.AddActionToFrontOfQueueForEntity(main, new UpdateMoodAction(Mood.Happy)); } } }); mainActionSequence.Add(branchingDialogue); otherActionSequence.Add(new PauseAction(3)); otherActionSequence.Add(new UpdateMoodAction(Mood.Angry)); var sync3 = new SyncedAction(main, other); mainActionSequence.Add(sync3); otherActionSequence.Add(sync3); mainActionSequence.Add(CommonActions.TalkToPlayer(new TolstoyTwoDialogue())); mainActionSequence.Add(new LeaveBarAction()); otherActionSequence.Add(new LeaveBarAction()); }
public static void DrinkOrWanderAroundIfIdle(List <Entity> matchingEntities) { foreach (var entity in matchingEntities) { if (ActionManagerSystem.Instance.IsEntityIdle(entity)) { if (Random.value > 0.8f) { var drinkRecipe = DrinkRecipes.GetRandomDrinkRecipe(); ActionManagerSystem.Instance.QueueAction(entity, GoToPaypointOrderDrinkAndSitDown(entity, drinkRecipe)); } else { ActionManagerSystem.Instance.QueueAction(entity, Wander()); } } } }