Exemplo n.º 1
0
        /// <summary>
        /// Generate a random sequence of enum type specified by the input parameter
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public IEnumerator <Enum> GetRandomSequence(CommonClass.Game_Parameter_Type type)
        {
            switch (type)
            {
            case CommonClass.Game_Parameter_Type.Size:
                return(Enum.GetValues(typeof(CommonClass.Size)).Cast <Enum>().OrderBy(x => _random.Next()).ToArray());

            case CommonClass.Game_Parameter_Type.Speed:
                return(Enum.GetValues(typeof(CommonClass.Speed)).Cast <Enum>().OrderBy(x => _random.Next()).ToArray());

            case CommonClass.Game_Parameter_Type.Punter:
                return(Enum.GetValues(typeof(CommonClass.Punter_Type)).Cast <Enum>().OrderBy(x => _random.Next()).ToArray());

            default: throw new NotImplementedException();
            }
        }
Exemplo n.º 2
0
        //Generate a random sequence according to input parameter
        public IEnumerable <Enum> GetRandomSequence(CommonClass.Game_Parameter_Type type)
        {
            switch (type)
            {
            //Return random tortoise type
            case CommonClass.Game_Parameter_Type.Racer_Type:
                return(Enum.GetValues(typeof(CommonClass.Racer_Type)).Cast <Enum>().OrderBy(x => _random.Next()).ToArray());

            //Return  speed of racer
            case CommonClass.Game_Parameter_Type.Speed:
                return(Enum.GetValues(typeof(CommonClass.Speed)).Cast <Enum>().OrderBy(x => _random.Next()).ToArray());

            //Return random Punter type
            case CommonClass.Game_Parameter_Type.Punter_Type:
                return(Enum.GetValues(typeof(CommonClass.Punter_Type)).Cast <Enum>().OrderBy(x => _random.Next()).ToArray());

            default: throw new NotImplementedException();
            }
        }