示例#1
0
 /// <Summary>normal constructor</Summary>
 public ParticleGenerator(string Name, int numFlush, int numDiscard, Color color, string sTextureName, ParticleUpdate method)
     : base(Name)
 {
     m_Color    = color;
     m_Flush    = numFlush;
     m_Discard  = numDiscard;
     m_sTexture = sTextureName;
     m_Texture  = new Image(m_sTexture);
     m_Method   = method;
 }
 private void Copy(ParticleGenerator other)
 {
     m_sName    = other.m_sName;
     m_Flush    = other.m_Flush;
     m_Discard  = other.m_Discard;
     m_sTexture = other.m_sTexture;
     m_Texture  = other.m_Texture;
     m_Method   = other.m_Method;
     m_bValid   = other.m_bValid;
 }
示例#3
0
        public Feu(Object3D parent)
            : base("Feu", 10, 20, Color.Red, @"Media\Particle.bmp", null)
        {
            Parent   = parent;
            m_Method = new ParticleUpdate(FeuUpdate);

            m_PointSize   = 8;
            m_PointScaleA = 0;
            m_PointScaleB = 0;
            m_PointScaleC = 1;

            m_ParticlesLimit       = (int)(150 * scale);
            m_EmitPositionModulate = new Vector3(0.5f, 0, 0.5f) * scale;
            m_EmitAccel            = new Vector3(0, 0, 0);
            m_EmitAccelModulate    = new Vector3(0.0f, 0.15f, 0.0f);
            m_EmitSpeed            = new Vector3(0.0f, 0.5f, 0.0f) * scale;
            m_EmitSpeedModulate    = new Vector3(0.2f, 0.3f, 0.2f) * scale;
        }
        private void sendObjectUpdate()
        {
            if (this.objects.Count == 0 || this.connections.Count == 0)
            {
                return;
            }

            var numberToUpdate = Math.Min(20, this.objects.Count); // TODO: replace ugly constant (20)

            var objectsToUpdate = new List <FreeObject>(numberToUpdate);

            while (this.objects.Count > 0 && numberToUpdate > 0)
            {
                var obj = this.objects.Dequeue();

                if (obj.Deleted)
                {
                    continue;
                }
                objectsToUpdate.Add(obj);

                numberToUpdate--;
            }

            foreach (var obj in objectsToUpdate)
            {
                this.objects.Enqueue(obj);
            }

            if (objectsToUpdate.Count == 0)
            {
                return;
            }

            var command = ParticleUpdate.Command(this.game, objectsToUpdate);

            var message = this.server.CreateMessage();

            message.Write((byte)IngameMessageType.Command);
            command.WriteToBuffer(message);

            this.server.SendMessage(message, this.connections,
                                    NetDeliveryMethod.UnreliableSequenced, Settings.Network.Channel.ParticleUpdates);
        }
示例#5
0
        public Bougie(Object3D parent)
            : base("Feu", 10, 20, Color.Red, @"Media\Flame02.bmp", null)
        {
            m_Method = new ParticleUpdate(BougieUpdate);

            Parent           = parent;
            m_ParticlesLimit = 10;

            m_EmitPositionModulate = new Vector3(0.2f, 0.0f, 0.2f);
            m_EmitAccel            = new Vector3(0, 0, 0);
            m_EmitAccelModulate    = new Vector3(0.0f, 0.15f, 0.0f);
            m_EmitSpeed            = new Vector3(0.0f, 0.5f, 0.0f);
            m_EmitSpeedModulate    = new Vector3(0.2f, 0.3f, 0.2f);

            m_PointSize   = 3;
            m_PointScaleA = 0;
            m_PointScaleB = 0;
            m_PointScaleC = 1;
        }
示例#6
0
 private void Copy(ParticleGenerator other)
 {
     m_sName        = other.m_sName;
     m_Flush        = other.m_Flush;
     m_Discard      = other.m_Discard;
     m_sTexture     = other.m_sTexture;
     m_Texture      = other.m_Texture;
     m_Method       = other.m_Method;
     m_fRate        = other.m_fRate;
     m_fEmitVel     = other.m_fEmitVel;
     m_Attitude     = other.m_Attitude;
     m_PitchWidth   = other.m_PitchWidth;
     m_HeadingWidth = other.m_HeadingWidth;
     m_PointSize    = other.m_PointSize;
     m_PointSizeMin = other.m_PointSizeMin;
     m_PointScaleA  = other.m_PointScaleA;
     m_PointScaleB  = other.m_PointScaleB;
     m_PointScaleC  = other.m_PointScaleC;
     m_bValid       = other.m_bValid;
 }
示例#7
0
 private void Copy(ParticleGenerator other)
 {
     m_Flush                = other.m_Flush;
     m_Discard              = other.m_Discard;
     m_sTexture             = other.m_sTexture;
     m_Method               = other.m_Method;
     m_fRate                = other.m_fRate;
     m_EmitAccel            = other.m_EmitAccel;
     m_EmitSpeed            = other.m_EmitSpeed;
     m_EmitAccelModulate    = other.m_EmitAccelModulate;
     m_EmitSpeedModulate    = other.m_EmitSpeedModulate;
     m_EmitPositionModulate = other.m_EmitPositionModulate;
     Rotation               = other.Rotation;
     Position               = other.Position;
     m_PointSize            = other.m_PointSize;
     m_PointSizeMin         = other.m_PointSizeMin;
     m_PointScaleA          = other.m_PointScaleA;
     m_PointScaleB          = other.m_PointScaleB;
     m_PointScaleC          = other.m_PointScaleC;
     m_bValid               = other.m_bValid;
 }
示例#8
0
 /// </Summary>normal constructor<//Summary>
 public ParticleGenerator(string sName, int numFlush, int numDiscard, Color color, string sTextureName, ParticleUpdate method) : base(sName)
 {
     m_sName    = sName;
     m_Color    = color;
     m_Flush    = numFlush;
     m_Discard  = numDiscard;
     m_sTexture = sTextureName;
     m_Method   = method;
     try
     {
         m_Texture = GraphicsUtility.CreateTexture(CGameEngine.Device3D, m_sTexture, Format.Unknown);
         try
         {
             m_VB = new VertexBuffer(typeof(CustomVertex.PositionColoredTextured), m_Discard,
                                     CGameEngine.Device3D, Usage.Dynamic | Usage.WriteOnly | Usage.Points,
                                     CustomVertex.PositionColoredTextured.Format, Pool.Default);
             m_bValid = true;
         }
         catch (DirectXException d3de)
         {
             Console.AddLine("Unable to create vertex buffer for " + m_sTexture);
             Console.AddLine(d3de.ErrorString);
         }
         catch (Exception e)
         {
             Console.AddLine("Unable to create vertex buffer for " + m_sTexture);
             Console.AddLine(e.Message);
         }
     }
     catch (DirectXException d3de)
     {
         Console.AddLine("Unable to create texture " + m_sTexture);
         Console.AddLine(d3de.ErrorString);
     }
     catch (Exception e)
     {
         Console.AddLine("Unable to create texture " + m_sTexture);
         Console.AddLine(e.Message);
     }
 }