コード例 #1
0
    public void Update()
    {
        TimeManager tm   = TimeManager.Instance;
        WorldTime   time = tm.WorldTime;

        textComponent.text = time.ToString();
    }
コード例 #2
0
    void OnDayTimeChanged( WorldTime.DayTimeTypes type )
    {
        DayTimeType = WorldTime.Instance.CurrentTimeType;

        if( DebugPrintTransition )
            Console.Instance.addGameChatMessage( type.ToString() );

        // Tests from largest to least times
        // doing reverse order in this way is slightly faster
        switch( type )
        {
        case WorldTime.DayTimeTypes.Midnight:
            FromSetting = Midnight;
            ToSetting = Dawn;
            break;

        case WorldTime.DayTimeTypes.Dawn:
            FromSetting = Dawn;
            ToSetting = Sunrise;
            break;

        case WorldTime.DayTimeTypes.Sunrise:
            FromSetting = Sunrise;
            ToSetting = Noon;
            break;

        case WorldTime.DayTimeTypes.Noon:
            FromSetting = Noon;
            ToSetting = Sunset;
            break;

        case WorldTime.DayTimeTypes.Sunset:
            FromSetting = Sunset;
            ToSetting = Twilight;
            break;

        case WorldTime.DayTimeTypes.Twilight:

            if( DayPercent >= WorldTime.Instance.TwilightTime )
            {
                FromSetting = Twilight;
                ToSetting = MidnightWrapped;
            }
            else
            {
                FromSetting = TwilightWrapped;
                ToSetting = Midnight;
            }

            break;
        }
    }