Ejemplo n.º 1
0
        public static IParticleFactory ReadParticleFactory(this NetIncomingMessage msg)
        {
            IParticleFactory f = null;
            int hash           = msg.ReadInt32();

            if (hash == typeof(ParticleSphereFactory).GUID.GetHashCode())
            {
                f = new ParticleSphereFactory();
            }
            else if (hash == typeof(ParticleImageFactory).GUID.GetHashCode())
            {
                f = new ParticleImageFactory();
            }
            else if (hash == typeof(ParticleSmokeFactory).GUID.GetHashCode())
            {
                f = new ParticleSmokeFactory();
            }
            else if (hash == typeof(BaseParticleFactory).GUID.GetHashCode())
            {
                f = new BaseParticleFactory();
            }
            else
            {
                Logger.Error("Reading unsupported factory! Hash " + hash);
            }

            Logger.Warn("Reading particle factory (" + f.GetType().Name + ") hash " + hash);

            f.ReadObject(msg);
            return(f);
        }
Ejemplo n.º 2
0
        public static ParticleEmmitor CreateBasicShockwave(SceneMgr mgr, Color color)
        {
            ParticleEmmitor e = new ParticleEmmitor(mgr, IdMgr.GetNewId(0));

            ParticleImageFactory f = new ParticleImageFactory();

            f.Color      = color;
            f.RenderSize = 100;
            f.Source     = new Uri("pack://application:,,,/resources/images/particles/explosion-particle.png");
            e.Factory    = f;

            return(e);
        }
Ejemplo n.º 3
0
        private void CreateShockWaveParticleEmmitor(Vector position)
        {
            ParticleEmmitor e = new ParticleEmmitor(null, IdMgr.GetNewId(0));

            e.MinLife  = 10f;
            e.MaxLife  = 10f;
            e.Position = position;
            e.MinSize  = 20;
            e.MaxSize  = 20;
            e.Amount   = 1;
            //e.SizeMultiplier = 20;
            e.Infinite = false;
            e.FireAll  = true;
            e.Enabled  = true;

            ParticleImageFactory f = new ParticleImageFactory();

            f.Color = Color.FromArgb(50, 227, 144, 61);
            //f.Color = Colors.White;
            f.Source  = new Uri("pack://application:,,,/resources/images/particles/explosion-particle.png");
            e.Factory = f;

            GameLevelManager.SendNewObject(mgr, e);
        }