DRObjects.DataStructures.DivineRightDateTime.SetTimeComponent C# (CSharp) Méthode

SetTimeComponent() public méthode

Sets a particular Time Component to a particular value. If the value is 'too large' it will trickle over
public SetTimeComponent ( DRTimeComponent component, int value ) : void
component DRTimeComponent
value int
Résultat void
        public void SetTimeComponent(DRTimeComponent component, int value)
        {
            if (component == DRTimeComponent.DAY || component == DRTimeComponent.MONTH)
            {
                value--; //Because people start days and months at 1
            }

            //First determine the current value
            long currentValue = GetTimeComponent(component);

            //Multiply that by the multiplier
            currentValue *= MULTIPLIERS[(int)component];

            time -= currentValue;

            //And replace it with our new value
            time += MULTIPLIERS[(int)component] * value;
        }