Ejemplo n.º 1
0
        /// <summary>
        /// Based on the moon or sun provided it will provide the x,y coordinate on a plane
        /// </summary>
        /// <param name="moonAndSun"></param>
        /// <param name="dDiameter"></param>
        /// <param name="dOffset"></param>
        /// <returns></returns>
        /// <exception cref="ArgumentOutOfRangeException"></exception>
        public Point2DFloat GetMoonSunPositionOnCircle(MoonsAndSun moonAndSun, double dDiameter, double dOffset)
        {
            switch (moonAndSun)
            {
            case MoonsAndSun.Trammel:
                return(GetSunMoonPosition(D_TRAMMEL_ANGLE, dDiameter, dOffset));

            case MoonsAndSun.Felucca:
                return(GetSunMoonPosition(D_FELUCCA_ANGLE, dDiameter, dOffset));

            case MoonsAndSun.Sun:
                return(GetSunMoonPosition(D_SUN_ANGLE, dDiameter, dOffset));

            default:
                throw new ArgumentOutOfRangeException(nameof(moonAndSun), moonAndSun, null);
            }
        }
Ejemplo n.º 2
0
        public MoonPhases GetMoonPhasesByTimeOfDay(TimeOfDay timeOfDay, MoonsAndSun moonsAndSun)
        {
            // the value stored is an offset and needs to be adjusted to a zero based index
            int getAdjustedValue(int nValue)
            {
                return(nValue - N_OFFSET_ADJUST);
            }

            switch (moonsAndSun)
            {
            case MoonsAndSun.Felucca:
                return((MoonPhases)getAdjustedValue(_moonPhaseChunk.GetAsByteList()[(timeOfDay.Day - 1) * 2]));

            case MoonsAndSun.Trammel:
                return((MoonPhases)getAdjustedValue(_moonPhaseChunk.GetAsByteList()[(timeOfDay.Day - 1) * 2 + 1]));

            case MoonsAndSun.Sun:
                return(MoonPhases.NoMoon);

            default:
                throw new Ultima5ReduxException("We have asked for a moon phase but did not met the criteria. " + timeOfDay);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Returns a numeric offset for the moon and sun types
 /// </summary>
 /// <param name="moonAndSun">particular moon or sun</param>
 /// <returns></returns>
 public int GetMoonsOrSunOffset(MoonsAndSun moonAndSun)
 {
     return((int)moonAndSun);
 }