コード例 #1
0
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            if (value is string)
            {
                PebbleType type = PebbleType.GetTypeFromName((string)value);

                if (type != null)
                {
                    return(type);
                }
                else
                {
                    return(PebbleType.PebbleTypes[0]);
                }
            }
            return(base.ConvertFrom(context, culture, value));
        }
コード例 #2
0
        public static void AddPebble(string type, LuaTable position, float rotX, float rotY, float rotZ)
        {
            //Log.WriteLine("Adding pebble of type \"" + type + "\".");

            Vector3 pos = LuaTableToVector3(position);
            Vector3 rot = new Vector3(rotX, rotY, rotZ);

            string     newType    = type.ToLower();
            PebbleType pebbleType = PebbleType.GetTypeFromName(newType);

            if (pebbleType == null)
            {
                new Problem(ProblemTypes.WARNING, "Pebble type \"" + newType + "\" not found. Skipping pebble.");
                return;
            }

            new Pebble(pebbleType, pos, rot);
        }