Пример #1
0
        public void CreateStatics(ContentManager content)
        {
            FixedInstanceArray pinetree = new FixedInstanceArray("pine", PrimitiveLibrary.BatchBillboardPrimitives["pine"], TextureManager.GetTexture(ContentPaths.Entities.Plants.pine), (int)(50 * GameSettings.Default.NumMotes), BlendState.AlphaBlend)
            {
                ShouldRebuild = true
            };

            AddInstances("pine", pinetree);

            FixedInstanceArray palmTree = new FixedInstanceArray("palm", PrimitiveLibrary.BatchBillboardPrimitives["palm"], TextureManager.GetTexture(ContentPaths.Entities.Plants.palm), (int)(50 * GameSettings.Default.NumMotes), BlendState.AlphaBlend)
            {
                ShouldRebuild = true
            };

            AddInstances("palm", palmTree);

            FixedInstanceArray snowPine = new FixedInstanceArray("snowpine", PrimitiveLibrary.BatchBillboardPrimitives["snowpine"], TextureManager.GetTexture(ContentPaths.Entities.Plants.snowpine), (int)(50 * GameSettings.Default.NumMotes), BlendState.AlphaBlend)
            {
                ShouldRebuild = true
            };

            AddInstances("snowpine", snowPine);


            CreateBillboard("berrybush", content, (int)(300 * GameSettings.Default.NumMotes));
            CreateBillboard("grass", content, (int)(300 * GameSettings.Default.NumMotes));
            CreateBillboard("frostgrass", content, (int)(300 * GameSettings.Default.NumMotes));
            CreateBillboard("flower", content, (int)(300 * GameSettings.Default.NumMotes));
            CreateBillboard("deadbush", content, (int)(300 * GameSettings.Default.NumMotes));
            CreateBillboard("vine", content, (int)(300 * GameSettings.Default.NumMotes));
            CreateBillboard("gnarled", content, (int)(300 * GameSettings.Default.NumMotes));
            CreateBillboard("mushroom", content, (int)(300 * GameSettings.Default.NumMotes));
        }
Пример #2
0
 protected void OnDeserialized(System.Runtime.Serialization.StreamingContext context)
 {
     if (Data.Animation.Primitives.Count == 0)
     {
         Data.Animation.CreatePrimitives(GameState.Game.GraphicsDevice);
     }
     Sprites = new FixedInstanceArray(Name, Data.Animation.Primitives[0], Data.Texture, Data.MaxParticles, Data.Blend);
     Data.Animation.Play();
 }
Пример #3
0
        private void CreateBillboard(string name, ContentManager content, int count)
        {
            FixedInstanceArray arr = new FixedInstanceArray(name, PrimitiveLibrary.BatchBillboardPrimitives[name], PrimitiveLibrary.BatchBillboardPrimitives[name].Texture, count, BlendState.AlphaBlend)
            {
                ShouldRebuild = true
            };

            AddInstances(name, arr);
        }
Пример #4
0
        public void RemoveInstances(string name, List <InstanceData> instances)
        {
            if (!Instances.ContainsKey(name))
            {
                return;
            }
            else
            {
                FixedInstanceArray data = Instances[name];

                for (int i = 0; i < instances.Count; i++)
                {
                    data.Remove(instances[i]);
                }
            }
        }
Пример #5
0
        public ParticleEmitter(ComponentManager manager, string name, GameComponent parent, Matrix localTransform, EmitterData emitterData) :
            base(name, parent, localTransform, Vector3.Zero, Vector3.Zero, false)
        {
            Particles = new List <Particle>();

            if (emitterData == null)
            {
                return;
            }
            Data         = emitterData;
            maxParticles = Data.MaxParticles;
            Sprites      = new FixedInstanceArray(name, Data.Animation.Primitives[0], emitterData.Texture, Data.MaxParticles, Data.Blend);
            Data.Animation.Play();

            TriggerTimer = new Timer(Data.EmissionFrequency, Data.ReleaseOnce);
        }
Пример #6
0
 public void AddInstances(string name, FixedInstanceArray instances)
 {
     Instances[name] = instances;
 }
Пример #7
0
 protected void OnDeserialized(System.Runtime.Serialization.StreamingContext context)
 {
     if (Data.Animation.Primitives.Count == 0)
     {
         Data.Animation.CreatePrimitives(GameState.Game.GraphicsDevice);
     }
     Sprites = new FixedInstanceArray(Name, Data.Animation.Primitives[0], Data.Texture, Data.MaxParticles, Data.Blend);
     Data.Animation.Play();
 }
Пример #8
0
        public ParticleEmitter(ComponentManager manager, string name, GameComponent parent, Matrix localTransform, EmitterData emitterData)
            : base(name, parent, localTransform, Vector3.Zero, Vector3.Zero, false)
        {
            Particles = new List<Particle>();

            if(emitterData == null)
            {
                return;
            }

            Data = emitterData;
            maxParticles = Data.MaxParticles;
            Sprites = new FixedInstanceArray(name, Data.Animation.Primitives[0], emitterData.Texture, Data.MaxParticles, Data.Blend);
            Data.Animation.Play();

            TriggerTimer = new Timer(Data.EmissionFrequency, Data.ReleaseOnce);
        }
Пример #9
0
        public void CreateStatics(ContentManager content)
        {
            FixedInstanceArray pinetree = new FixedInstanceArray("pine", PrimitiveLibrary.BatchBillboardPrimitives["pine"], TextureManager.GetTexture(ContentPaths.Entities.Plants.pine), (int)(50 * GameSettings.Default.NumMotes), BlendState.AlphaBlend)
            {
                ShouldRebuild = true
            };
            AddInstances("pine", pinetree);

            FixedInstanceArray palmTree = new FixedInstanceArray("palm", PrimitiveLibrary.BatchBillboardPrimitives["palm"], TextureManager.GetTexture(ContentPaths.Entities.Plants.palm), (int)(50 * GameSettings.Default.NumMotes), BlendState.AlphaBlend)
            {
                ShouldRebuild = true
            };
            AddInstances("palm", palmTree);

            FixedInstanceArray snowPine = new FixedInstanceArray("snowpine", PrimitiveLibrary.BatchBillboardPrimitives["snowpine"], TextureManager.GetTexture(ContentPaths.Entities.Plants.snowpine), (int)(50 * GameSettings.Default.NumMotes), BlendState.AlphaBlend)
            {
                ShouldRebuild = true
            };
            AddInstances("snowpine", snowPine);

            CreateBillboard("berrybush", content, (int)(300 * GameSettings.Default.NumMotes));
            CreateBillboard("grass", content, (int) (300 * GameSettings.Default.NumMotes));
            CreateBillboard("frostgrass", content, (int) (300 * GameSettings.Default.NumMotes));
            CreateBillboard("flower", content, (int) (300 * GameSettings.Default.NumMotes));
            CreateBillboard("deadbush", content, (int) (300 * GameSettings.Default.NumMotes));
            CreateBillboard("vine", content, (int) (300 * GameSettings.Default.NumMotes));
            CreateBillboard("gnarled", content, (int) (300 * GameSettings.Default.NumMotes));
            CreateBillboard("mushroom", content, (int)(300 * GameSettings.Default.NumMotes));
        }
Пример #10
0
 public void AddInstances(string name, FixedInstanceArray instances)
 {
     Instances[name] = instances;
 }
Пример #11
0
 private void CreateBillboard(string name, ContentManager content, int count)
 {
     FixedInstanceArray arr = new FixedInstanceArray(name, PrimitiveLibrary.BatchBillboardPrimitives[name], PrimitiveLibrary.BatchBillboardPrimitives[name].Texture, count, BlendState.AlphaBlend)
     {
         ShouldRebuild = true
     };
     AddInstances(name, arr);
 }