示例#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
        private static void ParseNebulaType(string path)
        {
            string name = Path.GetFileNameWithoutExtension(path).ToLower();

            NebulaType existingType = null;

            foreach (NebulaType type in NebulaType.NebulaTypes)
            {
                if (type.Name == name)
                {
                    existingType = type;
                    break;
                }
            }

            //Check if a type with that name already exists (because of multiple data paths)
            if (existingType == null)
            {
                new NebulaType(name);
            }
            else
            {
                //Overwrite existing style
                existingType.Name = name;
            }
        }
示例#3
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));
        }
示例#4
0
        public Nebula(string name, NebulaType type, Vector3 position, Vector4 color, float spin, float radius) : base(position)
        {
            Name = name;
            Spin = spin;

            Mesh = new MeshIcosphere(position, Vector3.One);
            Mesh.Material.Translucent = true;
            Mesh.Scale = new Vector3(this.radius);

            Nebulas.Add(this);

            Type   = type;
            Radius = radius;
            Color  = color;

            AllowRotation = false;
        }
示例#5
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);
        }