示例#1
0
            protected GameObject GetRandomObject(SimDescription sim, out WoohooLocationControl control)
            {
                List <WoohooLocationControl> values = GetValidLocations(sim);

                RandomUtil.RandomizeListOfObjects <WoohooLocationControl>(values);

                foreach (WoohooLocationControl value in values)
                {
                    if (!value.AllowLocation(mActor.SimDescription, false))
                    {
                        continue;
                    }

                    if (!value.AllowLocation(mTarget.SimDescription, false))
                    {
                        continue;
                    }

                    List <GameObject> objs = value.GetAvailableObjects(mActor, mTarget, TestInRoom);

                    if ((objs != null) && (objs.Count > 0))
                    {
                        control = value;

                        return(RandomUtil.GetRandomObjectFromList(objs));
                    }
                }

                foreach (WoohooLocationControl value in values)
                {
                    List <GameObject> objs = value.GetAvailableObjects(mActor, mTarget, TestOnLevel);

                    if ((objs != null) && (objs.Count > 0))
                    {
                        control = value;

                        return(RandomUtil.GetRandomObjectFromList(objs));
                    }
                }

                foreach (WoohooLocationControl value in values)
                {
                    List <GameObject> objs = value.GetAvailableObjects(mActor, mTarget, null);

                    if ((objs != null) && (objs.Count > 0))
                    {
                        control = value;

                        return(RandomUtil.GetRandomObjectFromList(objs));
                    }
                }

                control = null;

                return(null);
            }
示例#2
0
            public override InteractionTestResult Test(ref InteractionInstanceParameters parameters, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                try
                {
                    Sim actor = parameters.Actor as Sim;
                    if (actor == null)
                    {
                        return(InteractionTestResult.Root_Null_Actor);
                    }

                    if ((actor.LotCurrent == null) || (actor.LotCurrent.IsWorldLot))
                    {
                        greyedOutTooltipCallback = Common.DebugTooltip("World Lot");
                        return(InteractionTestResult.Tuning_LotAvailability);
                    }

                    WoohooLocationControl control = WoohooLocationControl.GetControl(GetLocation(parameters.Target));
                    if (control == null)
                    {
                        greyedOutTooltipCallback = Common.DebugTooltip("Control Denied");
                        return(InteractionTestResult.Def_TestFailed);
                    }

                    if (!control.AllowLocation(actor.SimDescription, false))
                    {
                        greyedOutTooltipCallback = Common.DebugTooltip("Location Denied");
                        return(InteractionTestResult.Def_TestFailed);
                    }

                    using (WoohooTuningControl tuningControl = new WoohooTuningControl(parameters.InteractionObjectPair.Tuning, Woohooer.Settings.mAllowTeenWoohoo))
                    {
                        InteractionTestResult result = base.Test(ref parameters, ref greyedOutTooltipCallback);

                        if ((greyedOutTooltipCallback == null) && (Common.kDebugging))
                        {
                            greyedOutTooltipCallback = delegate { return(result.ToString()); };
                        }

                        return(result);
                    }
                }
                catch (ResetException)
                {
                    throw;
                }
                catch (Exception e)
                {
                    Common.Exception(parameters.Actor, parameters.Target, e);
                    return(InteractionTestResult.GenericFail);
                }
            }
示例#3
0
            protected override void OnPerform()
            {
                WoohooLocationControl location = null;

                if (mObject == null)
                {
                    mObject = GetRandomObject(mActor.SimDescription, out location);
                }

                if ((mObject == null) || (location == null))
                {
                    return;
                }

                InteractionDefinition interaction = location.GetInteraction(mActor, mTarget, mStyle);

                if (interaction != null)
                {
                    IWooHooDefinition woohooDefinition = interaction as IWooHooDefinition;
                    if (woohooDefinition != null)
                    {
                        woohooDefinition.Attempts = mAttempts;
                    }

                    InteractionInstance instance = interaction.CreateInstance(mObject, mActor, new InteractionPriority(InteractionPriorityLevel.UserDirected), false, true);

                    if ((mActor.InteractionQueue != null) && (mActor.InteractionQueue.Add(instance)))
                    {
                        ScoringLookup.IncStat("Push Success " + location + " " + mStyle);
                    }
                    else
                    {
                        ScoringLookup.IncStat("Push Fail " + location + " " + mStyle);
                    }
                }
            }
示例#4
0
 public bool TestUse(ToiletStall obj)
 {
     return(obj.InWorld && WoohooLocationControl.TestRepaired(obj) && obj.UseCount == 0);
 }