Пример #1
0
        /// <summary>Raised after the game state is updated (≈60 times per second).</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event data.</param>
        private void OnUpdateTicked(object sender, UpdateTickedEventArgs e)
        {
            CheckForGameSave();
            CheckForLevelUpMenu();

            if (e.IsMultipleOf(30))                             // half-second
            {
                ToolProficiencyHandler.HandleToolProficiency(); //from what I can tell of the original game code, tools cannot be used quicker than 600ms, so a half second tick is the largest tick that will always catch that the tool was used.
            }
            if (e.IsOneSecond)
            {
                UpdateExperience(); //one second tick for this, as the detection of changed experience can happen as infrequently as possible. a 10 second tick would be well within tolerance.
            }
        }
Пример #2
0
 private static void HalfSecondTick(object sender, EventArgs args)
 {
     //from what I can tell of the original game code, tools cannot be used quicker than 600ms, so a half second tick is the largest tick that will always catch that the tool was used.
     ToolProficiencyHandler.HandleToolProficiency();
 }