public DustCloud() : base(Vector3.Zero)
        {
            Name = "dustCloud" + DustClouds.Count;

            Mesh = new MeshIcosphere(Vector3.Zero, Vector3.One, true);
            Mesh.Material.Translucent = true;

            Radius     = lastRadius;
            Mesh.Scale = new Vector3(Radius);

            if (lastType != null)
            {
                type = lastType;
            }
            else
            {
                type = DustCloudType.DustCloudTypes[0];
            }

            Resources = lastResources;
            Spin      = lastSpin;
            Refill    = lastRefill;
            Color     = lastColor;

            DustClouds.Add(this);
            AllowRotation = false;
        }
Beispiel #2
0
        public static void AddDustCloudWithResources(string name, string type, LuaTable position, float resources, LuaTable color, float spin, float radius, int refill)
        {
            //Log.WriteLine("Adding dust cloud \"" + name + "\".");

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

            string        newType       = type.ToLower();
            DustCloudType dustCloudType = DustCloudType.GetTypeFromName(newType);

            bool bRefill = false;

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

            if (dustCloudType == null)
            {
                new Problem(ProblemTypes.WARNING, "Dust cloud type \"" + newType + "\" not found. Skipping dust cloud \"" + name + "\".");
                return;
            }

            new DustCloud(name, dustCloudType, pos, resources, col, spin, radius, bRefill);
        }
Beispiel #3
0
        private static void ParseDustCloudType(string path)
        {
            lua = new Lua();
            lua.RegisterFunction("StartDustCloudConfig", null, typeof(HWData).GetMethod("StartDustCloudConfig"));

            /*lua.RegisterFunction("setCollisionDamageToModifier", this, GetType().GetMethod("SetCollisionDamageToModifier"));
             * lua.RegisterFunction("setCollisionDamageFromModifier", this, GetType().GetMethod("SetCollisionDamageFromModifier"));
             * lua.RegisterFunction("SpawnAsteroidOnDeath", this, GetType().GetMethod("SpawnAsteroidOnDeath"));
             * lua.RegisterFunction("resourceAttackMode", this, GetType().GetMethod("ResourceAttackMode"));*/
            lua.DoFile(path);

            string name = Path.GetFileNameWithoutExtension(path).ToLower();

            Vector4 pixelColor = Vector4.Zero;

            foreach (KeyValuePair <object, object> de in dustCloudConfig)
            {
                switch (de.Key.ToString())
                {
                case "pixelColour":
                    pixelColor = LuaMap.LuaTableToVector4((LuaTable)de.Value);
                    break;
                }
            }

            DustCloudType existingType = null;

            foreach (DustCloudType type in DustCloudType.DustCloudTypes)
            {
                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 DustCloudType(name, pixelColor);
            }
            else
            {
                //Overwrite existing style
                existingType.Name       = name;
                existingType.PixelColor = pixelColor;
            }
        }
        public DustCloud(string name, DustCloudType type, Vector3 position, Vector4 color, float spin, float radius) : base(position)
        {
            Name = name;
            Spin = spin;

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

            DustClouds.Add(this);

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

            AllowRotation = false;
        }
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            if (value is string)
            {
                DustCloudType type = DustCloudType.GetTypeFromName((string)value);

                if (type != null)
                {
                    return(type);
                }
                else
                {
                    return(DustCloudType.DustCloudTypes[0]);
                }
            }
            return(base.ConvertFrom(context, culture, value));
        }
Beispiel #6
0
        public static void AddDustCloud(string name, string type, LuaTable position, LuaTable color, float spin, float radius)
        {
            //Log.WriteLine("Adding dust cloud \"" + name + "\".");

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

            string        newType       = type.ToLower();
            DustCloudType dustCloudType = DustCloudType.GetTypeFromName(newType);

            if (dustCloudType == null)
            {
                new Problem(ProblemTypes.WARNING, "Dust cloud type \"" + newType + "\" not found. Skipping dust cloud \"" + name + "\".");
                return;
            }

            new DustCloud(name, dustCloudType, pos, col, spin, radius);
        }