Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ CreateGroup()

static List< BatsGroupSkyEntity > Terraria.GameContent.Skies.AmbientSky.BatsGroupSkyEntity.CreateGroup ( Player player,
FastRandom random )
inlinestatic

Definition at line 988 of file AmbientSky.cs.

989 {
991 int num = 100;
992 int num2 = random.Next(20, 40);
994 SpriteEffects spriteEffects = ((!(Main.WindForVisuals > 0f)) ? SpriteEffects.FlipHorizontally : SpriteEffects.None);
995 Vector2 vector = default(Vector2);
996 if (spriteEffects == SpriteEffects.FlipHorizontally)
997 {
998 vector.X = virtualCamera.Position.X + virtualCamera.Size.X + (float)num;
999 }
1000 else
1001 {
1002 vector.X = virtualCamera.Position.X - (float)num;
1003 }
1004 vector.Y = random.NextFloat() * ((float)Main.worldSurface * 16f - 1600f - 2400f) + 2400f;
1005 float num3 = random.NextFloat() * 3f + 3f;
1006 int num4 = random.Next(30, 61) * 60;
1007 Vector2 vector2 = new Vector2(random.NextFloat() * 0.5f + 0.5f, random.NextFloat() * 0.5f + 0.5f);
1008 Vector2 targetOffset = new Vector2(random.NextFloat() * 2f - 1f, random.NextFloat() * 2f - 1f) * 100f;
1009 for (int i = 0; i < num2; i++)
1010 {
1012 batsGroupSkyEntity.Depth = num3 + random.NextFloat() * 0.5f;
1013 batsGroupSkyEntity.Position = vector + new Vector2(random.NextFloat() * 20f - 10f, random.NextFloat() * 3f) * 50f;
1014 batsGroupSkyEntity.Effects = spriteEffects;
1015 batsGroupSkyEntity.SetPositionInWorldBasedOnScreenSpace(batsGroupSkyEntity.Position);
1016 batsGroupSkyEntity.LifeTime = num4 + random.Next(301);
1017 batsGroupSkyEntity.SetMagnetization(vector2 * (random.NextFloat() * 0.3f + 0.85f) * 0.05f, targetOffset);
1019 }
1020 return list;
1021 }
void Add(TKey key, TValue value)
BatsGroupSkyEntity(Player player, FastRandom random)

References Terraria.GameContent.Skies.AmbientSky.BatsGroupSkyEntity.BatsGroupSkyEntity(), System.Collections.Generic.Dictionary< TKey, TValue >.Add(), System.list, Terraria.Utilities.FastRandom.Next(), Terraria.Utilities.FastRandom.NextFloat(), Microsoft.Xna.Framework.Graphics.Vector2, and Terraria.Main.worldSurface.

Referenced by Terraria.GameContent.Skies.AmbientSky.Spawn().