private void Setup(HavenLocationEvent templateArg)
    {
        eventId = templateArg.eventId;

        /*potentialLocations = new List<HavenLocation>();
         * foreach (HavenLocation iterLoc in templateArg.potentialLocations)
         * {
         *  potentialLocations.Add(iterLoc);
         * }*/
        locatedSpot = templateArg.locatedSpot;

        associatedCharId = templateArg.associatedCharId;
        associatedWaifu  = templateArg.associatedWaifu;

        associatedDaysOfWeek = new List <DayOfWeek>();
        foreach (DayOfWeek iterDay in templateArg.associatedDaysOfWeek)
        {
            associatedDaysOfWeek.Add(iterDay);
        }

        requiredFlags = new List <string>();
        foreach (string iterFlag in templateArg.requiredFlags)
        {
            requiredFlags.Add(iterFlag);
        }

        requiresAssociatedWaifuSexuallyComfortable = false;

        isRepeatable      = templateArg.isRepeatable;
        focusesOnHcontent = templateArg.focusesOnHcontent;
    }
示例#2
0
    /// <summary>
    /// Returns whether the given event can be used on today's day of the week.
    /// </summary>
    private bool CanEventBeUsedOnDayOfWeek(HavenLocationEvent eventArg, DayOfWeek dayOfWeekArg)
    {
        // if given event does NOT require a certain day
        if (!eventArg.RequiresCertainDayOfWeek())
        {
            // return that event can be used on given day
            return(true);
        }

        // return whether given day matches one of given events needed days
        return(eventArg.associatedDaysOfWeek.Contains(dayOfWeekArg));
    }
示例#3
0
    /// <summary>
    /// Removes event from active list and adds to watched non-repeatable event list if appropriate.
    /// Call after an event's dialogue has been played.
    /// </summary>
    /// <param name="eventArg"></param>
    public void AddEventToSeen(HavenLocationEvent eventArg)
    {
        // remove given event from active events list
        todaysEvents.RemoveAll(iterEvent => iterEvent.eventId == eventArg.eventId);

        // if given event is non-repeatable
        if (!eventArg.isRepeatable)
        {
            // add given event to non-repeatable watched list
            nonRepeatableEventsSeen.Add(new HavenLocationEvent(eventArg));
        }
    }
示例#4
0
    /// <summary>
    /// Returns whether the given event passes the flag check based on given set flags.
    /// </summary>
    /// <param name="eventArg"></param>
    /// <param name="gameFlagsArg"></param>
    /// <returns></returns>
    private bool HaveRequiredFlags(HavenLocationEvent eventArg, GameFlags gameFlagsArg)
    {
        // if given event does NOT require flags
        if (!eventArg.RequiresFlag())
        {
            // return that passed flag check
            return(true);
        }

        // loop through all given events needed flags
        foreach (string iterFlag in eventArg.GetAppropriateRequiredFlags(gameFlagsArg))
        {
            // if given flags do NOT have the iterating needed flag
            if (!gameFlagsArg.IsFlagSet(iterFlag))
            {
                // return that did NOT pass flag check
                return(false);
            }
        }

        // return that passed flag check
        return(true);
    }
示例#5
0
    /// <summary>
    /// Plans the days events. Call when entering a new day.
    /// </summary>
    /// <param name="gameFlagsArg"></param>
    /// <param name="todaysDayArg"></param>
    /// <param name="canHcontentBeViewedArg"></param>
    /// <param name="maxNumEventsToPlanArg"></param>
    public void PlanTodaysEvents(GameFlags gameFlagsArg, DayOfWeek todaysDayArg,
                                 bool canHcontentBeViewedArg, int maxNumEventsToPlanArg)
    {
        // set no events as currently active
        todaysEvents = new List <HavenLocationEvent>();

        // load all haven location event templates
        HavenLocationEventTemplate[] allLoadedLocEventTemplates = AssetRefMethods.LoadAllBundleAssetHavenLocationEventTemplates();

        // get all haven locatione events from loaded templates
        List <HavenLocationEvent> allLoadedLocEvents = new List <HavenLocationEvent>();

        foreach (HavenLocationEventTemplate iterTemp in allLoadedLocEventTemplates)
        {
            allLoadedLocEvents.Add(new HavenLocationEvent(iterTemp));
        }

        // get all location events that can potentially be used today
        List <HavenLocationEvent> allPotentialLocEvents = GetAllPotentialEventsForToday(
            allLoadedLocEvents, gameFlagsArg, todaysDayArg, canHcontentBeViewedArg);

        // get a random number of events that should be placed
        int randNumOfEvents = UnityEngine.Random.Range(0, maxNumEventsToPlanArg);

        // initialize vars for upcoming loop
        List <HavenLocationEvent> currentPotentialLocEvents;
        int randomIndex;
        HavenLocationEvent selectedEvent;

        // loop for as many events as should be retrieved
        for (int i = 0; i < randNumOfEvents; i++)
        {
            // reset the list of currently potential events
            currentPotentialLocEvents = new List <HavenLocationEvent>();

            /// loop through all potential events. NOTE: Need to re-screen potential events to
            /// ensure that they do not colfict with the previously set events
            foreach (HavenLocationEvent iterEvent in allPotentialLocEvents)
            {
                // if iterating event is already active
                if (IsEventActive(iterEvent))
                {
                    // skip to next loop iteration
                    continue;
                }

                // if char associated with iterating event is already used in an active event
                if (ActiveEventsUsingCharacter(iterEvent.GetAppropriateAssociatedCharacterId()))
                {
                    // skip to next loop iteration
                    continue;
                }

                // if location of iterating event is already being used by an active event
                if (ActiveEventsUsingLocation(iterEvent.locatedSpot))
                {
                    // skip to next loop iteration
                    continue;
                }

                // add iterating event to currently potential events
                currentPotentialLocEvents.Add(iterEvent);
            }

            // if there is no available events that could be used
            if (currentPotentialLocEvents.Count == 0)
            {
                // print warning to console
                Debug.LogWarning("Problem in PlanTodaysEvents(). Not any more potential events to use!");

                // DONT continue code
                return;
            }

            // get random index from event list
            randomIndex = UnityEngine.Random.Range(0, currentPotentialLocEvents.Count);

            // get the randomly chosen event
            selectedEvent = new HavenLocationEvent(currentPotentialLocEvents[randomIndex]);

            // add selected event to today's active events
            todaysEvents.Add(selectedEvent);
            // denote that selected event has been used for the week
            eventsUsedInCurrentWeek.Add(selectedEvent);
        }
    }
示例#6
0
 /// <summary>
 /// Returns whether the given event is non-repeatable and has already been seen.
 /// </summary>
 /// <param name="eventArg"></param>
 /// <returns></returns>
 private bool HasNonRepeatableEventBeenSeen(HavenLocationEvent eventArg)
 {
     return(nonRepeatableEventsSeen.Exists(iterEvent => iterEvent.eventId == eventArg.eventId));
 }
示例#7
0
 /// <summary>
 /// Returns whether the given event has already been used this week.
 /// </summary>
 /// <param name="eventArg"></param>
 /// <returns></returns>
 private bool HasEventBeenUsedThisWeek(HavenLocationEvent eventArg)
 {
     return(eventsUsedInCurrentWeek.Exists(iterEvent => iterEvent.eventId == eventArg.eventId));
 }
示例#8
0
 /// <summary>
 /// Returns whether the given event is already active.
 /// </summary>
 /// <param name="eventArg"></param>
 /// <returns></returns>
 public bool IsEventActive(HavenLocationEvent eventArg)
 {
     return(todaysEvents.Exists(iterEvent => iterEvent.eventId == eventArg.eventId));
 }
 public HavenLocationEvent(HavenLocationEvent templateArg)
 {
     Setup(templateArg);
 }