Exemplo n.º 1
0
        private void PushSimToDrink(Actors.Sim sim, IBarProfessional bar, String bestDrinkName)
        {
            List <InteractionObjectPair> interactions       = bar.GetAllInteractionsForActor(sim);
            InteractionDefinition        drinkingDefinition = null;

            foreach (InteractionObjectPair interaction in interactions)
            {
                InteractionDefinition interactionDef = interaction.InteractionDefinition;
                string name = interactionDef.GetInteractionName(sim, bar, interaction);

                if (name != null && name.Contains(bestDrinkName))
                {
                    drinkingDefinition = interactionDef;
                    break;
                }
            }

            if (drinkingDefinition != null)
            {
                IEnumerable <InteractionInstance> actions  = sim.InteractionQueue.InteractionList;
                List <InteractionInstance>        toCancel = new List <InteractionInstance>();
                bool alreadyDrinking = false;
                foreach (InteractionInstance action in actions)
                {
                    if (!(action is BarProfessional.BarInteraction))
                    {
                        toCancel.Add(action);
                    }
                    else
                    {
                        alreadyDrinking = true;
                        break;
                    }
                }

                foreach (InteractionInstance action in toCancel)
                {
                    sim.InteractionQueue.CancelInteraction(action, false);
                }
                if (!alreadyDrinking)
                {
                    sim.InteractionQueue.AddAfterCheckingForDuplicates(drinkingDefinition.CreateInstance(bar, sim, new InteractionPriority(InteractionPriorityLevel.RequiredNPCBehavior), true, false));
                }
            }
        }
Exemplo n.º 2
0
        public override string GetInteractionName()
        {
            if ((WooHooer != null) && (WooHooee != null))
            {
                Sim sim = (Actor == WooHooer) ? WooHooee : WooHooer;

                IWooHooDefinition definition = InteractionDefinition as IWooHooDefinition;
                if (definition != null)
                {
                    string name = (definition.GetStyle(this) == CommonWoohoo.WoohooStyle.TryForBaby) ? "TryForBabyWith" : "WooHooWith";
                    return(ActorTrailer.LocalizeString(name, new object[] { sim }));
                }
            }

            InteractionInstanceParameters parameters = GetInteractionParameters();

            return(InteractionDefinition.GetInteractionName(ref parameters));
        }
Exemplo n.º 3
0
        private void PushSimToDrink(Actors.Sim sim, IBarProfessional bar, String bestDrinkName)
        {
            if (Message.Sender.IsDebugging())
            {
                Message.Sender.Debug(this, "Best drink for " + sim.FullName + " is: " + bestDrinkName);
            }
            List <InteractionObjectPair> interactions       = bar.GetAllInteractionsForActor(sim);
            InteractionDefinition        drinkingDefinition = null;

            foreach (InteractionObjectPair interaction in interactions)
            {
                InteractionDefinition interactionDef = interaction.InteractionDefinition;
                string name = interactionDef.GetInteractionName(sim, bar, interaction);

                if (name != null && name.Contains(bestDrinkName))
                {
                    drinkingDefinition = interactionDef;
                    break;
                }
            }

            if (drinkingDefinition != null)
            {
                IEnumerable <InteractionInstance> actions  = sim.InteractionQueue.InteractionList;
                List <InteractionInstance>        toCancel = new List <InteractionInstance>();
                bool alreadyDrinking = false;
                foreach (InteractionInstance action in actions)
                {
                    if (!(action is BarProfessional.BarInteraction))
                    {
                        if (Message.Sender.IsDebugging())
                        {
                            Message.Sender.Debug(this, "Canceling " + action.GetInteractionName());
                        }
                        toCancel.Add(action);
                    }
                    else
                    {
                        if (Message.Sender.IsDebugging())
                        {
                            Message.Sender.Debug(this, "Sim is already drinking, no push added");
                        }
                        alreadyDrinking = true;
                        break;
                    }
                }

                foreach (InteractionInstance action in toCancel)
                {
                    sim.InteractionQueue.CancelInteraction(action, false);
                }
                if (!alreadyDrinking)
                {
                    sim.InteractionQueue.AddAfterCheckingForDuplicates(drinkingDefinition.CreateInstance(bar, sim, new InteractionPriority(InteractionPriorityLevel.RequiredNPCBehavior), true, false));
                    if (Message.Sender.IsDebugging())
                    {
                        Message.Sender.Debug(this, "Sim was pushed to drink: " + sim.FullName);
                    }
                }
            }
        }
Exemplo n.º 4
0
 public override string GetInteractionName()
 {
     return(InteractionDefinition.GetInteractionName(Actor, Target, InteractionObjectPair));
 }