Example #1
0
    private void UpdateAnimalPrecense()
    {
        if (m_CurrentAnimal == null)
        {
            return;
        }

        DateTime dateTime = GameClock.Instance.GetDateTime();

        //If the animal ran away
        if (dateTime >= m_EndTime)
        {
            Reset();
            return;
        }

        //If the animal doesn't reveal itself at this time
        float     percentageOfPODPassed = 0.0f;
        PartOfDay partOfDay             = SuntimeCalculator.GetPartOfDay(52.079208, 5.140324, dateTime, ref percentageOfPODPassed);

        bool canSpawn = m_CurrentAnimal.CanSpawn(partOfDay, percentageOfPODPassed, false);

        if (canSpawn == false)
        {
            Reset();
            return;
        }
    }
Example #2
0
    private void Refresh(DateTime date)
    {
        float     percentage = 0.0f;
        PartOfDay partOfDay  = SuntimeCalculator.GetPartOfDay(52.079208, 5.140324, date, ref percentage);

        Gradient currentGradient;

        //TODO: Lame, quickly just for demo. This system will eventually change drastically
        switch (partOfDay)
        {
        case PartOfDay.Dawn:
            currentGradient = m_DawnGradient;
            break;

        case PartOfDay.Day:
            currentGradient = m_DayGradient;
            break;

        case PartOfDay.Dusk:
            currentGradient = m_DuskGradient;
            break;

        case PartOfDay.Night:
            currentGradient = m_NightGradient;
            break;

        default:
            currentGradient = m_DayGradient;
            break;
        }

        m_SpriteRenderer.color = currentGradient.Evaluate(percentage);
    }
Example #3
0
    private void Tick(DateTime dateTime)
    {
        float     percentageOfPODPassed = 0.0f;
        PartOfDay partOfDay             = SuntimeCalculator.GetPartOfDay(52.079208, 5.140324, dateTime, ref percentageOfPODPassed);

        //Loop backwards so removing is not an issue
        //foreach (WorldObject worldObject in m_WorldObjects)
        for (int i = m_WorldObjects.Count - 1; i >= 0; --i)
        {
            m_WorldObjects[i].Tick(dateTime, partOfDay, percentageOfPODPassed);
        }

        m_LastTickTime = dateTime;
    }
Example #4
0
    private void Refresh(DateTime date)
    {
        float     percentage = 0.0f;
        PartOfDay partOfDay  = SuntimeCalculator.GetPartOfDay(52.079208, 5.140324, date, ref percentage);

        //If it's day
        float degrees = 0.0f;

        //TODO: Lame, quickly just for demo. This system will eventually change drastically
        switch (partOfDay)
        {
        case PartOfDay.Dawn:
            degrees = (percentage * 10.0f * -1.0f) + 5.0f;
            break;

        case PartOfDay.Day:
            degrees = (percentage * 170.0f * -1.0f) - 5.0f;
            break;

        case PartOfDay.Dusk:
            degrees = (percentage * 10.0f * -1.0f) + 185.0f;
            break;

        case PartOfDay.Night:
            degrees = (percentage * 170.0f * -1.0f) + 175.0f;
            break;

        default:
            degrees = 0.0f;
            break;
        }

        transform.localRotation = Quaternion.Euler(0.0f, 0.0f, degrees);

        if (RefreshEvent != null)
        {
            RefreshEvent();
        }
    }