Пример #1
0
        /// <summary>
        /// Clone this object
        /// </summary>
        /// <returns></returns>
        public object Clone()
        {
            var clone = new GameTimeData();

            clone.Date = (GameDate)Date.Clone();
            clone.Step = Step;
            return(clone);
        }
Пример #2
0
        /// <summary>
        /// Get the difference between this date and another given date in timesteps.
        /// </summary>
        /// <param name="other"></param>
        /// <returns></returns>
        public int TimeStepDifference(GameTimeData other)
        {
            int difference    = other.Step - Step;
            var dayDifference = (int)(other.Date.DateTime - Date.DateTime).TotalDays;

            difference += dayDifference * GameTime.Instance.ClockSteps;
            return(difference);
        }
Пример #3
0
        /// <summary>
        /// Restore the state of this object from the current savegame.
        /// </summary>
        private void LoadState()
        {
            var saveGame = SaveGameSystem.Instance.GetCurrentSaveGame();

            data = saveGame.gameTime;
        }
Пример #4
0
 /// <summary>
 /// Initialize the default state.
 /// </summary>
 private void Initialize()
 {
     data = new GameTimeData();
 }