Пример #1
0
            private static void AddPregIcon(Transform pregIconTransform, AgentData heroine)
            {
                var image = pregIconTransform.GetComponent <Image>();

                _currentHeroine.Add(new KeyValuePair <AgentData, RectTransform>(heroine, image.GetComponent <RectTransform>()));

                var status = heroine.GetHeroineStatus(heroine.GetPregnancyData());

                switch (status)
                {
                case HeroineStatus.Unknown:
                    image.sprite = _unknownSprite;
                    break;

                case HeroineStatus.OnLeave:
                    image.sprite = _leaveSprite;
                    break;

                case HeroineStatus.Safe:
                    image.sprite = _safeSprite;
                    break;

                case HeroineStatus.Risky:
                    image.sprite = _riskySprite;
                    break;

                case HeroineStatus.Pregnant:
                    image.sprite = _pregSprite;
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
        public static HeroineStatus GetHeroineStatus(this AgentData heroine, PregnancyData pregData = null)
        {
            if (heroine == null)
            {
                return(HeroineStatus.Unknown);
            }
            if (pregData == null)
            {
                pregData = heroine.GetPregnancyData();
            }

            var chaControl = heroine.GetNPC()?.ChaControl;

            if (chaControl == null)
            {
                return(HeroineStatus.Unknown);
            }

            // Check if she wants to tell
            if (heroine.SickState.ID == AIProject.Definitions.Sickness.GoodHealthID && !heroine.IsWet &&
                (chaControl.fileGameInfo.phase > 2 ||
                 heroine.StatsTable[(int)Status.Type.Mood] > 95 ||
                 heroine.StatsTable[(int)Status.Type.Immoral] > 95 ||
                 heroine.StatsTable[(int)Status.Type.Motivation] > 140))
            {
                var pregnancyWeek = pregData.Week;
                if (pregnancyWeek > 0)
                {
                    if (PregnancyPlugin.ShowPregnancyIconEarly.Value)
                    {
                        return(HeroineStatus.Pregnant);
                    }
                    // Different personalities notice at different times
                    if (_earlyDetectPersonalities.Contains(chaControl.fileParam.personality))
                    {
                        if (pregnancyWeek > 1)
                        {
                            return(HeroineStatus.Pregnant);
                        }
                    }
                    else if (_lateDetectPersonalities.Contains(chaControl.fileParam.personality))
                    {
                        if (pregnancyWeek > 11)
                        {
                            return(HeroineStatus.Pregnant);
                        }
                    }
                    else
                    {
                        if (pregnancyWeek > 5)
                        {
                            return(HeroineStatus.Pregnant);
                        }
                    }
                }

                var pregCharCtrl = chaControl.GetComponent <PregnancyCharaController>();
                return(!pregCharCtrl.isDangerousDay
                        ? HeroineStatus.Safe
                        : HeroineStatus.Risky);
            }

            return(HeroineStatus.Unknown);
        }