Exemplo n.º 1
0
    public void ProcessSeasonEvent(SeasonEvent seasonEvent)
    {
        if (seasonEvent == null)
        {
            return;
        }

        foreach (var scarecrow in _scarecrowManager.ScarecrowsLeftToRight)
        {
            if (scarecrow.IsAflame)
            {
                scarecrow.DamageAllParts(fireDamage);
            }
        }

        switch (seasonEvent.Type)
        {
        case SeasonEventType.None:
            return;

        case SeasonEventType.GentleRain:
            ProcessGentleRain(seasonEvent.Duration);
            break;

        case SeasonEventType.Thunderstorm:
            ProcessThunderstorm(seasonEvent.Duration);
            break;

        case SeasonEventType.Blizzard:
            ProcessBlizzard(seasonEvent.Duration);
            break;

        case SeasonEventType.Tornado:
            ProcessTornado(seasonEvent.Duration);
            break;

        case SeasonEventType.MeteoriteStorm:
            ProcessMeteoriteStorm(seasonEvent.Duration);
            break;

        case SeasonEventType.AsteroidStrike:
            ProcessAsteroidStrike(seasonEvent.Duration);
            break;

        default:
            throw new System.ArgumentOutOfRangeException();
        }
    }
Exemplo n.º 2
0
    void Awake()
    {
        print("In Awake");

        // Enforce Singleton pattern
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
        }

        // Initialize Unity Events
        m_SeasonChange = new SeasonEvent();
        m_YearChange   = new UnityEvent();

        // Initialize variables
        time          = 0;
        currentSeason = Season.fall;
    }