Exemple #1
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            if (Sim.CreatedSim != null)
            {
                // Clear Missing School/Work punishments if a sim goes back to school
                Punishment manager = Punishment.GetPunishmentManagerFromSim(Sim.CreatedSim);
                if (manager != null)
                {
                    if (manager.HasUnpunishedDeviantBehaviors())
                    {
                        bool valid = false;
                        foreach (Punishment.DeviantBehaviorInstance instance in manager.mUnpunishedDeviantBehaviors)
                        {
                            switch (instance.Type)
                            {
                            case Punishment.DeviantBehaviorType.MissingSchool:
                            case Punishment.DeviantBehaviorType.MissingWork:
                                break;

                            default:
                                valid = true;
                                break;
                            }

                            if (valid)
                            {
                                break;
                            }
                        }

                        if (!valid)
                        {
                            manager.mUnpunishedDeviantBehaviors = null;
                        }
                    }
                }
            }

            Add(frame, new ActiveCareerToneScenario(Sim), ScenarioResult.Start);
            Add(frame, new InactiveCareerToneScenario(Sim), ScenarioResult.Failure);

            return(Careers.ResetBoss(this, Event.Career));
        }