示例#1
0
    private IEnumerator DelayedGentleRainEffects(float delay)
    {
        yield return(new WaitForSeconds(delay));

        foreach (var scarecrow in _scarecrowManager.ScarecrowsLeftToRight)
        {
            scarecrow.SetWet();
        }

        _scarecrowManager.AssignResourcesToAllPlayers(gentleRainResources);
    }
示例#2
0
    private IEnumerator ProcessSeasonEvents()
    {
        Debug.Log("Your forecast for " + CurrentSeason.Type + ": " + string.Join(", ", _currentSeasonEvents.Select(e => e.Type)));

        if (CurrentSeason.Type == SeasonType.Summer)
        {
            foreach (var scarecrow in _scarecrowManager.ScarecrowsLeftToRight)
            {
                scarecrow.RemoveWet();
            }
        }

        float duration = 0f;

        for (int i = 0; i < _currentSeasonEvents.Count; i++)
        {
            var seasonEvent = _currentSeasonEvents.ElementAt(i);
            duration += seasonEvent.Duration;
        }

        _timePassageCinematicManager.PassTime(duration);

        _uiManager.PlayNextSeasonOnBar((int)CurrentSeason.Type, duration);

        for (int i = 0; i < _currentSeasonEvents.Count; i++)
        {
            var seasonEvent = _currentSeasonEvents.ElementAt(i);
            OnSeasonEventChanged.Invoke(seasonEvent.Type);
            _seasonEventManager.ProcessSeasonEvent(seasonEvent);
            yield return(new WaitForSeconds(seasonEvent.Duration));
        }

        ClearSeasonEvents();

        OnSeasonEventChanged.Invoke(SeasonEventType.None);

        _scarecrowManager.AssignResourcesToAllPlayers(GetResourcesForSeason());

        if (CurrentSeason.Type == SeasonType.Summer)
        {
            OnYearEnded.Invoke();
        }
        else
        {
            OnSeasonEnded.Invoke();
        }

        ChangeSeason();
    }