Exemple #1
0
 public void DisplayRooms()
 {
     foreach (Tuple <int, Point> roomLocationPair in this._roomLocationPairs)
     {
         Dust.QuickDust(roomLocationPair.Item2, Main.hslToRgb((float)((double)roomLocationPair.Item1 * 0.0500000007450581 % 1.0), 1f, 0.5f));
     }
 }
Exemple #2
0
 public void DisplayRooms()
 {
     foreach (Tuple <int, Point> roomLocationPair in _roomLocationPairs)
     {
         Dust.QuickDust(roomLocationPair.Item2, Main.hslToRgb((float)roomLocationPair.Item1 * 0.05f % 1f, 1f, 0.5f));
     }
 }
Exemple #3
0
 // Token: 0x06000F0C RID: 3852 RVA: 0x003F088C File Offset: 0x003EEA8C
 public void DisplayRooms()
 {
     foreach (Tuple <int, Point> current in this._roomLocationPairs)
     {
         Dust.QuickDust(current.Item2, Main.hslToRgb((float)current.Item1 * 0.05f % 1f, 1f, 0.5f));
     }
 }
 public void DisplayRooms()
 {
     using (List <Tuple <int, Point> > .Enumerator enumerator = this._roomLocationPairs.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             Tuple <int, Point> current = enumerator.Current;
             Dust.QuickDust(current.Item2, Main.hslToRgb((float)((double)current.Item1 * 0.0500000007450581 % 1.0), 1f, 0.5f));
         }
     }
 }
Exemple #5
0
        public override void AI()
        {
            // Since projectiles have 2 ai slots, and I don't want to do manual syncing of an extra variable, here I use the HalfVector2 and ReinterpretCast.FloatAsUInt to get a Vector2 from 1 float variable instead of 2 like normal.
            Vector2 target = new HalfVector2()
            {
                PackedValue = ReLogic.Utilities.ReinterpretCast.FloatAsUInt(projectile.ai[0])
            }.ToVector2();

            Rectangle targetRectangle = new Rectangle((int)target.X - 4, (int)target.Y - 4, 8, 8);

            if (projectile.Hitbox.Intersects(targetRectangle))
            {
                projectile.Kill();
                return;
            }
            Vector2 targetDirection = new Vector2(target.X, target.Y) - projectile.Center;

            projectile.velocity = Vector2.Normalize(targetDirection) * 5f;
            // Using the player's index, which we passed into ai[1], we can differentiate kills by assigning a hue to the dust we spawn
            float hue = ((int)(projectile.ai[1]) % 6) / 6f;

            Dust.QuickDust(projectile.Center, Main.hslToRgb(hue, 1f, 0.5f));
        }
Exemple #6
0
        internal static int GetPoolStats(Vector2 startPosition, out bool lava, out bool honey)
        {
            // Vanilla code to determine pool size of a liquid lake
            // Added GetTileSafely just in case, and a visualizer

            // This only works if the start position is already in liquid
            int startX = (int)(startPosition.X / 16f);
            int startY = (int)(startPosition.Y / 16f);

            if (Main.tile[startX, startY].liquid < 0)
            {
                // ???
                startY++;
            }

            lava  = false;
            honey = false;
            int leftStart = startX;
            int rightEnd  = startX;

            while (leftStart > 10 && Framing.GetTileSafely(leftStart, startY).liquid > 0 && !WorldGen.SolidTile(leftStart, startY))
            {
                leftStart--;
            }

            for (; rightEnd < Main.maxTilesX - 10 && Framing.GetTileSafely(rightEnd, startY).liquid > 0 && !WorldGen.SolidTile(rightEnd, startY); rightEnd++)
            {
            }

            int poolSize = 0;

            for (int x = leftStart; x <= rightEnd; x++)
            {
                int y = startY;
                while (Framing.GetTileSafely(x, y).liquid > 0 && !WorldGen.SolidTile(x, y) && y < Main.maxTilesY - 10)
                {
                    poolSize++;
                    y++;
                    Tile tile = Framing.GetTileSafely(x, y);
                    if (tile.lava())
                    {
                        lava = true;
                    }
                    else if (tile.honey())
                    {
                        honey = true;
                    }

                    // Added code to visualize pool dimensions
                    if (poolSize < 1000)
                    {
                        // 1000 is highest value vanilla checks
                        Dust.QuickDust(new Point(x, y - 1), Color.Orange);
                    }
                }
            }

            if (honey)
            {
                poolSize = (int)(poolSize * 1.5f);
            }

            return(poolSize);
        }