示例#1
0
    protected override void UpdateSprite(Month pCurrentMonth)
    {
        TimeManager.MonthNames currentSeason = TimeManager.Instance.CurrentMonth.Name;
        TreeBase target = GetComponent <TreeBase>();

        NativeTree = target.NativeTree;

        if (Sprite != null)
        {
            if (NativeTree == true)
            {
                if (target.ProduceSeasons.Contains(currentSeason))
                {
                    if (target.FloweringSprite != null)
                    {
                        GetComponent <SpriteRenderer>().sprite = target.FloweringSprite;
                    }
                    else
                    {
                        Sprite.sprite = SeasonSprites[TimeManager.Instance.CurrentMonthIndex];
                    }
                }
            }
            else
            {
                Sprite.sprite = SeasonSprites[TimeManager.Instance.CurrentMonthIndex];
            }
        }
    }
    public CalendarEntry SetEntry(TimeManager.MonthNames pMonth, int pDay)
    {
        Entries = Resources.LoadAll <CalendarEntry>("CalendarEntries/" + pMonth.ToString());

        foreach (CalendarEntry entry in Entries)
        {
            if (entry.Month == pMonth && entry.Day == pDay)
            {
                CurrentEntry = entry;
                CurrentEvent = CurrentEntry.Event;
                if (CurrentEvent != null)
                {
                    if (CurrentEvent.Competition != null)
                    {
                        Game.NPCs.Blossoms.BlossomCompetitionManager.Instance.SelectCompetition(CurrentEvent.Competition.Name, CurrentEvent.Presenter.transform);
                    }
                }
                if (CurrentEvent != null)
                {
                    foreach (FestivalProp obj in CurrentEvent.Props)
                    {
                        if (GameManager.Instance.LevelName == obj.Level)
                        {
                            Instantiate(obj.Prop, obj.Position, transform.rotation);
                        }
                    }
                }
                return(entry);
            }
        }
        CurrentEntry = null;
        CurrentEvent = null;

        return(null);
    }
示例#3
0
    protected virtual void DayChange(int pDayIndex)
    {
        DroppedItems = 0;

        if (YieldsProduce)
        {
            TimeManager.MonthNames currentSeason = TimeManager.Instance.PastSeasons[pDayIndex];
            CurrentProduceGrowth++;
            if (!ProduceSeasons.Contains(currentSeason))
            {
                CurrentProduceGrowth = 0;
                ProduceReady         = false;
            }
            else
            {
                if (FloweringSprite != null)
                {
                    GetComponent <SpriteRenderer>().sprite = FloweringSprite;
                }
            }
            if (CurrentProduceGrowth >= ProduceGrowthTime)
            {
                ProduceReady = true;
            }
            else
            {
                ProduceReady = false;
            }
            SetProduceSprite();
        }

        if (Mature == false)
        {
            CurrentGrowth++;
            if (CurrentGrowth >= TargetGrowth && NextPhaseProp != null)
            {
                GameObject next = Instantiate(NextPhaseProp, transform.position, transform.rotation, transform.parent);

                Destroy(gameObject);
            }
        }
    }
示例#4
0
        void Populate(int pDayIndex)
        {
            PopulateLists();
            TimeManager.MonthNames currentSeason = TimeManager.Instance.CurrentMonth.Name;
            CurrentItems = PossibleItems;
            List <StoreItem> seasonalItems = new List <StoreItem>();

            switch (currentSeason)
            {
            case TimeManager.MonthNames.Spring:
                seasonalItems = SpringExclusives;
                break;

            case TimeManager.MonthNames.Summer:
                seasonalItems = SummerExclusives;
                break;

            case TimeManager.MonthNames.Fall:
                seasonalItems = FallExclusives;
                break;

            case TimeManager.MonthNames.Winter:
                seasonalItems = WinterExclusives;
                break;

            default:
                break;
            }

            foreach (StoreItem item in seasonalItems)
            {
                if (!CurrentItems.Contains(item))
                {
                    CurrentItems.Add(item);
                }
            }

            PopulateStorage();
        }
 void SetMonth(Month pCurrentMonth)
 {
     CurrentMonthName = pCurrentMonth.Name;
 }
示例#6
0
    public bool CheckValidity()
    {
        if (CalendarManager.Instance.CurrentEvent != null && FestivalAllowed == false)
        {
            return(false);
        }
        if (EventManager.Instance.PlayedEvents.Contains(this))
        {
            //    Debug.Log("already played");

            return(false);
        }
        int currentDay = TimeManager.Instance.PassedDays;

        if (currentDay < MinimumDays)
        {
            //   Debug.Log("Too early");

            return(false);
        }
        string currentLocation  = GameManager.Instance.LevelName;
        string previousLocation = GameManager.Instance.PreviousLevelName;

        if (currentLocation != Location)
        {
            //    Debug.Log("wrong location");

            return(false);
        }
        if (FromLocation != string.Empty && previousLocation != FromLocation)
        {
            //    Debug.Log("from wrong location");
            return(false);
        }
        if (PreRequisites.Count > 0)
        {
            foreach (GameEvent prerequisite in PreRequisites)
            {
                if (EventManager.Instance.PlayedEvents.Contains(prerequisite) == false)
                {
                    //       Debug.Log("prerequisite not seen");

                    return(false);
                }
            }
        }
        TimeManager.MonthNames currentMonth = TimeManager.Instance.CurrentMonth.Name;
        if (AllowedMonths.Count > 0 && AllowedMonths.Contains(currentMonth) == false)
        {
            //   Debug.Log("wrong season");

            return(false);
        }
        TimeManager.WeekDays currentWeekday = TimeManager.Instance.CurrentWeekDayName;
        if (AllowedWeekdays.Count > 0 && AllowedWeekdays.Contains(currentWeekday) == false)
        {
            //    Debug.Log("wrong week day");

            return(false);
        }
        WeatherType currentWeather = WeatherManager.Instance.CurrentWeather;

        if (AllowedWeathers.Count > 0 && AllowedWeathers.Contains(currentWeather) == false)
        {
            //    Debug.Log("wrong weather");

            return(false);
        }
        int currentHour   = TimeManager.Instance.CurrentHour;
        int currentMinute = TimeManager.Instance.CurrentMinute;

        if (HourSpan.StartHour != -1 && TimeManager.Instance.CheckWithinHourSpan(HourSpan, currentHour, currentMinute) == false)
        {
            //   Debug.Log("not within timespan");

            return(false);
        }
        return(true);
    }