コード例 #1
0
        public static void AddNebulaWithResources(string name, string type, LuaTable position, float resources, LuaTable color, float spin, float radius, int refill)
        {
            //Log.WriteLine("Adding nebula \"" + name + "\".");

            Vector3 pos = LuaTableToVector3(position);
            Vector4 col = LuaTableToVector4(color);

            string     newType    = type.ToLower();
            NebulaType nebulaType = NebulaType.GetTypeFromName(newType);

            bool bRefill = false;

            if (refill != 0)
            {
                bRefill = true;
            }

            if (nebulaType == null)
            {
                new Problem(ProblemTypes.WARNING, "Nebula type \"" + newType + "\" not found. Skipping nebula \"" + name + "\".");
                return;
            }

            new Nebula(name, nebulaType, pos, resources, col, spin, radius, bRefill);
        }
コード例 #2
0
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            if (value is string)
            {
                NebulaType type = NebulaType.GetTypeFromName((string)value);

                if (type != null)
                {
                    return(type);
                }
                else
                {
                    return(NebulaType.NebulaTypes[0]);
                }
            }
            return(base.ConvertFrom(context, culture, value));
        }
コード例 #3
0
        public static void AddNebula(string name, string type, LuaTable position, LuaTable color, float spin, float radius)
        {
            //Log.WriteLine("Adding nebula \"" + name + "\".");

            Vector3 pos = LuaTableToVector3(position);
            Vector4 col = LuaTableToVector4(color);

            string     newType    = type.ToLower();
            NebulaType nebulaType = NebulaType.GetTypeFromName(newType);

            if (nebulaType == null)
            {
                new Problem(ProblemTypes.WARNING, "Nebula type \"" + newType + "\" not found. Skipping nebula \"" + name + "\".");
                return;
            }

            new Nebula(name, nebulaType, pos, col, spin, radius);
        }