Esempio n. 1
0
        public static ActionSequence GettingFrosty(Entity main)
        {
            var sequence = new ActionSequence("GettingFrosty");

            sequence.Add(CommonActions.TalkToPlayer(new WeirdOrderDialogue()));
            sequence.Add(new DialogueBranchAction(new Dictionary <DialogueOutcome, Action>
            {
                { DialogueOutcome.Bad, () => {
                      ActionManagerSystem.Instance.AddActionToFrontOfQueueForEntity(main, new UpdateMoodAction(Mood.Angry));
                  } },
                { DialogueOutcome.Default, () => {
                      ActionManagerSystem.Instance.AddActionToFrontOfQueueForEntity(main, CommonActions.WaitForDrink(main, "Mind Meld", new DrinkOrders.ExactDrinkorder(DrinkRecipes.GetDrinkRecipe("Mind Meld"), main.GetState <NameState>().Name), 10));
                  } }
            }));

            return(sequence);
        }
Esempio n. 2
0
        public static void Start(List <Entity> matchingEntities)
        {
            Analytics.CustomEvent("Day Three Started");

            var mcGraw = EntityQueries.GetEntityWithName(matchingEntities, NPCS.McGraw.Name);
            var player = EntityQueries.GetEntityWithName(matchingEntities, NPCName.You);

            //McGraw
            var mcGrawSequence = new ActionSequence("McGrawTutorial");

            if (!GameSettings.DisableTutorial)
            {
                mcGrawSequence.Add(new TeleportAction(Locations.OutsideDoorLocation()));
                mcGrawSequence.Add(new GetWaypointAction(Goal.PayFor));
                mcGrawSequence.Add(new GoToWaypointAction());
                mcGrawSequence.Add(new ConversationAction(new TutorialIntroDiaglogue()));
                mcGrawSequence.Add(new DialogueBranchAction(new Dictionary <DialogueOutcome, Action>
                {
                    {
                        DialogueOutcome.Nice, () =>
                        {
                            ActionManagerSystem.Instance.AddActionToFrontOfQueueForEntity(mcGraw,
                                                                                          new UpdateMoodAction(Mood.Happy));
                            StaticStates.Get <OutcomeTrackerState>().AddOutcome("You made a good impression on McGraw.");
                        }
                    },
                    {
                        DialogueOutcome.Mean, () =>
                        {
                            ActionManagerSystem.Instance.AddActionToFrontOfQueueForEntity(mcGraw,
                                                                                          new UpdateMoodAction(Mood.Angry));
                            StaticStates.Get <OutcomeTrackerState>().AddOutcome("You and McGraw haven't got off to the best start.");
                        }
                    }
                }));
                mcGrawSequence.Add(CommonActions.QueueForDrinkOrder(mcGraw, 10, 20));
                const string drinkName   = "Mind Meld";
                var          drinkRecipe = DrinkRecipes.GetDrinkRecipe(drinkName);

                var orderSequence = new ConditionalActionSequence("Drink order", false);
                var drinkOrder    = new DrinkOrders.ExactDrinkorder(drinkRecipe, mcGraw.GetState <NameState>().Name);
                orderSequence.Add(new StartDrinkOrderAction(drinkOrder));
                mcGrawSequence.Add(orderSequence);
                orderSequence.Add(CommonActions.WaitForDrink(mcGraw, drinkName, drinkOrder, 90, true, new DrinkSucsessDialogue()));
                mcGrawSequence.Add(new RemoveTutorialControlLockAction());
                mcGrawSequence.Add(new FadeToBlackAction(6.5f, "First day. Just open the bar then serve the right drinks, Easy?"));
                mcGrawSequence.Add(new PauseAction(3.0f));
                mcGrawSequence.Add(new CallbackAction(() =>
                {
                    EventSystem.EndDrinkMakingEvent.Invoke();
                    ActionManagerSystem.Instance.AddActionToFrontOfQueueForEntity(player,
                                                                                  new TeleportAction(Locations.CenterOfBar()));
                })); //This is kind of dirty - but demo!
                mcGrawSequence.Add(new DestoryEntityInInventoryAction());
                mcGrawSequence.Add(new TeleportAction(Locations.SitDownPoint3()));
                mcGrawSequence.Add(new SetReactiveConversationAction(new McGrawMorningOne(), mcGraw));
                mcGrawSequence.Add(CommonActions.SitDownLoop());
                ActionManagerSystem.Instance.QueueAction(mcGraw, mcGrawSequence);

                //Player
                var playerSequence = new ActionSequence("PlayerTutorial");
                playerSequence.Add(new TeleportAction(Locations.OutsideDoorLocation()));
                playerSequence.Add(new GetWaypointAction(Goal.RingUp));
                playerSequence.Add(new GoToWaypointAction());
                ActionManagerSystem.Instance.QueueAction(player, playerSequence);
            }
            else
            {
                mcGrawSequence.Add(new TeleportAction(Locations.SitDownPoint3()));
                mcGrawSequence.Add(new SetReactiveConversationAction(new McGrawMorningOne()));
                mcGrawSequence.Add(CommonActions.SitDownLoop());
                ActionManagerSystem.Instance.QueueAction(mcGraw, mcGrawSequence);
            }

            var loveStoryActions = LoveStory.DayOneMorning();

            foreach (var actionPair in loveStoryActions)
            {
                var entity = actionPair.GetEntity();
                var action = actionPair.GetGameAction();
                ActionManagerSystem.Instance.QueueAction(entity, action);
            }
        }
Esempio n. 3
0
        public static ConditionalActionSequence WaitForDrink(Entity entity, string drinkOrIngerdientOrdered, DrinkOrders.DrinkOrder drinkOrder, int timeoutInGameMins, bool retry = false, Conversation correctDrinkConversation = null, Conversation incorrectDrinkConversation = null, Dictionary <String, GameAction> otherDrinkActions = null)
        {
            var waitForDrink = new ConditionalActionSequence("WaitForDrink");

            waitForDrink.Add(new OnFailureDecorator(
                                 new DrinkIsInInventoryAction(drinkOrder, timeoutInGameMins), //TODO: Need to account for the "No drink" case here.
                                 () => {
                if (entity.GetState <InventoryState>().Child != null)
                {
                    if (retry)    //If retry is true then you are stuck until you don't fail.
                    {
                        ActionManagerSystem.Instance.AddActionToFrontOfQueueForEntity(entity, WaitForDrink(entity, drinkOrIngerdientOrdered, drinkOrder, 99999, true, correctDrinkConversation, incorrectDrinkConversation));
                        ActionManagerSystem.Instance.AddActionToFrontOfQueueForEntity(entity, new ConversationAction(new Dialogues.OrderDrinkRetryConverstation()));
                        ActionManagerSystem.Instance.AddActionToFrontOfQueueForEntity(entity, new DestoryEntityInInventoryAction());
                    }
                    else
                    {
                        var drinkInHand        = entity.GetState <InventoryState>().Child.HasState <DrinkState>() ? entity.GetState <InventoryState>().Child.GetState <DrinkState>() : null;
                        var otherDrinkResponse = drinkInHand != null && otherDrinkActions != null ? otherDrinkActions.Keys.First(otherDrink => DrinkState.IsIdentical(drinkInHand, DrinkRecipes.GetDrinkRecipe(otherDrink).Contents)) : null;
                        if (otherDrinkResponse != null)
                        {
                            ActionManagerSystem.Instance.AddActionToFrontOfQueueForEntity(entity, otherDrinkActions[otherDrinkResponse]);
                        }
                        else
                        {
                            if (incorrectDrinkConversation == null)
                            {
                                var reason        = entity.GetState <ActionBlackboardState>().IncorrectDrinkReason;
                                bool destroyDrink = false;
                                var conversation  = DialogueSelector.GetIncorrectDrinkOrderConversation(drinkOrIngerdientOrdered, entity, reason, out destroyDrink);

                                ActionManagerSystem.Instance.AddActionToFrontOfQueueForEntity(entity, new ConversationAction(conversation));
                                if (destroyDrink)
                                {
                                    ActionManagerSystem.Instance.AddActionToFrontOfQueueForEntity(entity, new DestoryEntityInInventoryAction());
                                }
                            }
                            else
                            {
                                ActionManagerSystem.Instance.AddActionToFrontOfQueueForEntity(entity, new ConversationAction(incorrectDrinkConversation));
                            }
                            ActionManagerSystem.Instance.AddActionToFrontOfQueueForEntity(entity, new UpdateMoodAction(Mood.Angry));
                        }
                    }
                    ActionManagerSystem.Instance.AddActionToFrontOfQueueForEntity(entity, new EndDrinkOrderAction());
                    ActionManagerSystem.Instance.AddActionToFrontOfQueueForEntity(entity, new ReleaseWaypointAction());
                }
                else
                {
                    bool destroyDrink;
                    var timeoutConversation = DialogueSelector.GetIncorrectDrinkOrderConversation(drinkOrIngerdientOrdered, entity, IncorrectDrinkReason.Timeout, out destroyDrink);
                    ActionManagerSystem.Instance.AddActionToFrontOfQueueForEntity(entity, new ConversationAction(timeoutConversation));
                    ActionManagerSystem.Instance.AddActionToFrontOfQueueForEntity(entity, new EndDrinkOrderAction());
                    ActionManagerSystem.Instance.AddActionToFrontOfQueueForEntity(entity, new ReleaseWaypointAction());
                    ActionManagerSystem.Instance.AddActionToFrontOfQueueForEntity(entity, new UpdateMoodAction(Mood.Angry));
                }
            })
                             );

            waitForDrink.Add(new ClearConversationAction());


            //Only if not failed
            if (correctDrinkConversation != null)
            {
                waitForDrink.Add(new ConversationAction(correctDrinkConversation));
            }
            else
            {
                waitForDrink.Add(new ConversationAction(DialogueSelector.GetCorrectDrinkOrderConversation(entity)));
            }

            waitForDrink.Add(new TriggerAnimationAction(AnimationEvent.ItemTakeTrigger));
            waitForDrink.Add(new ModifyMoneyAction(Constants.DrinkSucsessMoney, PaymentType.DrinkSale));

            waitForDrink.Add(new EndDrinkOrderAction());
            waitForDrink.Add(new ReleaseWaypointAction());
            waitForDrink.Add(new UpdateMoodAction(Mood.Happy));

            return(waitForDrink);
        }