Example #1
0
        public static ConditionalActionSequence QueueForDrinkOrder(Entity entity, int findWaypointTimeout = 0, int getToWaypointTimeout = 0)
        {
            var queueForDrink = new ConditionalActionSequence("QueueForDrink");

            queueForDrink.Add(
                new OnFailureDecorator(
                    new GetWaypointAction(Goal.PayFor, true, true, findWaypointTimeout),
                    () =>
            {
                ActionManagerSystem.Instance.QueueAction(entity, new ReleaseWaypointAction());
                ActionManagerSystem.Instance.QueueAction(entity, new UpdateMoodAction(Mood.Angry));
            }
                    ));
            queueForDrink.Add(new GoToWaypointAction());
            //Consider re-adding if we miss it.
//            queueForDrink.Add(
//            new OnFailureDecorator(
//                new WaitForWaypointWithUserAction(Goal.RingUp, StaticStates.Get<PlayerState>().Player, getToWaypointTimeout), //Does not reserve wayponit.
//                () =>
//                {
//                    ActionManagerSystem.Instance.QueueAction(entity, new ReleaseWaypointAction());
//                    ActionManagerSystem.Instance.QueueAction(entity, new UpdateMoodAction(Mood.Angry));
//                    ActionManagerSystem.Instance.QueueAction(entity, Wander());
//                })
//            );
            return(queueForDrink);
        }
Example #2
0
        public static ConditionalActionSequence GoToPaypointOrderDrinkAndSitDown(Entity entity, DrinkRecipe drinkRecipe, int orderTimeoutInMins = 20)
        {
            var orderingAndDrinking = new ConditionalActionSequence("OrderingAndDrinking");

            orderingAndDrinking.Add(GoToPaypointAndOrderDrink(entity, drinkRecipe, orderTimeoutInMins));
            orderingAndDrinking.Add(SitDownAndDrink());

            return(orderingAndDrinking);
        }
Example #3
0
        public static ConditionalActionSequence GoToPaypointAndOrderDrink(Entity entity, DrinkRecipe drinkRecipe, int orderTimeoutInMins = 20)
        {
            var orderDrink = new ConditionalActionSequence("OrderDrinkIfPossible");

            orderDrink.Add(QueueForDrinkOrder(entity, 10, 20));
            DrinkOrders.ExactDrinkorder drinkOrder = new DrinkOrders.ExactDrinkorder(drinkRecipe, entity.GetState <NameState>().Name);
            orderDrink.Add(DrinkOrders.OrderDrink(entity, drinkOrder, DialogueSelector.GetExactDrinkOrderConversation(drinkOrder.Recipe.DrinkName, entity), orderTimeoutInMins: orderTimeoutInMins));
            return(orderDrink);
        }
Example #4
0
        public static ConditionalActionSequence SitDownLoop()
        {
            var sitDown = new ConditionalActionSequence("Sit down", true);

            sitDown.Add(new SitDownAction());
            sitDown.Add(new TriggerAnimationAction(AnimationEvent.ChairTalk1Trigger));
            sitDown.Add(new PauseAction(4.0f));
            sitDown.Add(new CallbackAction(() => sitDown.Add(SitDownLoop()))); //Lol
            return(sitDown);
        }
Example #5
0
        public static GameAction OrderDrinkWithoutFailure(Entity entity, DrinkOrder drinkOrder, Conversation conversation, int orderTimeoutInMins = 20)
        {
            var orderDrink = new ParallelUntilAllCompleteAction("OrderDrink");

            orderDrink.Add(new ReportSuccessDecorator(new ConversationAction(conversation)));
            var waitForDrink = new ConditionalActionSequence("WaitForDrink");

            waitForDrink.Add(new StartDrinkOrderAction(drinkOrder));
            waitForDrink.Add(CommonActions.WaitForDrinkWithoutFailure(entity, drinkOrder, orderTimeoutInMins));
            orderDrink.Add(waitForDrink);
            return(orderDrink);
        }
Example #6
0
        public static ActionSequence OrderDrink(Entity entity, DrinkOrder drinkOrder, Conversation conversation, Conversation correctDrinkConversation = null, Conversation incorrectDrinkConversation = null, Dictionary <String, GameAction> otherDrinkActions = null, int orderTimeoutInMins = 40)
        {
            var wrapper    = new ActionSequence("DrinkOrderThenClear");
            var orderDrink = new ParallelUntilAllCompleteAction("OrderDrink");

            orderDrink.Add(new ReportSuccessDecorator(new ConversationAction(conversation)));
            var waitForDrink = new ConditionalActionSequence("WaitForDrink");

            waitForDrink.Add(new StartDrinkOrderAction(drinkOrder));
            waitForDrink.Add(CommonActions.WaitForDrink(entity, drinkOrder.OrderedItem, drinkOrder, orderTimeoutInMins, correctDrinkConversation: correctDrinkConversation, incorrectDrinkConversation: incorrectDrinkConversation, otherDrinkActions: otherDrinkActions));
            orderDrink.Add(waitForDrink);
            wrapper.Add(orderDrink);
            wrapper.Add(new ClearConversationAction());
            return(wrapper);
        }
Example #7
0
        public static ConditionalActionSequence WaitForDrinkWithoutFailure(Entity entity, DrinkOrders.DrinkOrder drinkOrder, int timeoutInGameMins)
        {
            var waitForDrink = new ConditionalActionSequence("WaitForDrink");

            waitForDrink.Add(new DrinkIsInInventoryAction(drinkOrder, timeoutInGameMins));
            return(waitForDrink);
        }
Example #8
0
        private static ConditionalActionSequence OfferDrugs(Entity drugPusher)
        {
            var receiveSpot = StaticStates.Get <BarEntities>().ReceiveSpot;

            var drugsTemplate = new List <IState>
            {
                new PrefabState(Prefabs.Drugs),
                new DrinkState(new DrinkState()),
                new PositionState(receiveSpot.GameObject.transform.position),
                new InventoryState()
            };

            var sequence = new ConditionalActionSequence("DrugOfferSequence");

            sequence.Add(new ReportSuccessDecorator(new ConversationAction(new DrugPusherOfferConversation())));
            sequence.Add(new PlaceItemInReceiveSpot(drugsTemplate));
            sequence.Add(new WaitForReceivedItemDecision());
            sequence.Add(new ClearConversationAction());
            return(sequence);
        }
Example #9
0
        private static ConditionalActionSequence CheerLoop(int repetitions)
        {
            var cheer = new ConditionalActionSequence("Cheer");

            if (Random.value < 0.50f)
            {
                cheer.Add(new TriggerAnimationAction(AnimationEvent.Cheer3Trigger));
            }
            else if (Random.value < 0.75f)
            {
                cheer.Add(new TriggerAnimationAction(AnimationEvent.Cheer1Trigger));
            }
            else
            {
                cheer.Add(new TriggerAnimationAction(AnimationEvent.Cheer2Trigger));
            }
            cheer.Add(new PauseAction(4.0f));
            if (repetitions > 1)
            {
                cheer.Add(new CallbackAction(() => cheer.Add(CheerLoop(repetitions - 1)))); //Lol
            }
            return(cheer);
        }
Example #10
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);
            }
        }
Example #11
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);
        }