예제 #1
0
        public override void AI()
        {
            if (!GotTiles)
            {
                GotTiles = true;

                int startPosX = (int)Main.screenPosition.X / 16;
                int startPosY = (int)Main.screenPosition.Y / 16;

                int tilesToPickX = Main.screenWidth / 16 + 1;
                int tilesToPickY = Main.screenHeight / 16 + 1;

                for (int i = startPosX; i < startPosX + tilesToPickX; i++)
                {
                    for (int j = startPosY; j < startPosY + tilesToPickY; j++)
                    {
                        Tile tile = Main.tile[i, j];

                        Color lightColor = Lighting.GetColor(i, j);

                        if (tile.wall != WallID.None)
                        {
                            FakeWalls.Add(new FakeTileData(tile.wall, new Vector2(i * 16, j * 16) - new Vector2(8), new Rectangle(tile.wallFrameX(), tile.wallFrameY(), 36, 36), lightColor));
                        }

                        if (tile.active())
                        {
                            FakeTiles.Add(new FakeTileData(tile.type, new Vector2(i * 16, j * 16), new Rectangle(tile.frameX, tile.frameY, 16, 16), lightColor));
                        }
                    }
                }
            }

            if (TimeLeft == 575)
            {
                foreach (FakeTileData fakes in FakeTiles)
                {
                    fakes.Velocity          = new Vector2(Main.rand.Next(-4, 4), -Main.rand.NextFloat(2));
                    fakes.RotationDirection = Main.rand.NextBool() ? -1 : 1;
                    fakes.RotationSpeed     = (float)(Main.rand.Next(12, 64)) * 0.001f;
                }

                foreach (FakeTileData fakes in FakeWalls)
                {
                    fakes.Velocity          = new Vector2(Main.rand.Next(-4, 4), -Main.rand.NextFloat(2));
                    fakes.RotationDirection = Main.rand.NextBool() ? -1 : 1;
                    fakes.RotationSpeed     = (float)(Main.rand.Next(12, 64)) * 0.001f;
                }
            }

            if (TimeLeft < 575)
            {
                foreach (FakeTileData fakes in FakeTiles)
                {
                    fakes.Position += fakes.Velocity;
                    fakes.Rotation += fakes.RotationSpeed * fakes.RotationDirection;
                    fakes.Opacity  -= 0.0075f;
                    fakes.Color     = Color.Lerp(fakes.Color, Color.White, 0.04f);
                }

                foreach (FakeTileData fakes in FakeWalls)
                {
                    fakes.Position += fakes.Velocity;
                    fakes.Rotation += fakes.RotationSpeed * fakes.RotationDirection;
                    fakes.Opacity  -= 0.0075f;
                    fakes.Color     = Color.Lerp(fakes.Color, Color.White, 0.04f);
                }
            }

            if (TimeLeft > 575 && TimeLeft < 600)
            {
                foreach (FakeTileData fakes in FakeTiles)
                {
                    fakes.VFXOffset = new Vector2(Main.rand.Next(-2, 2), Main.rand.Next(-2, 2));
                }

                foreach (FakeTileData fakes in FakeWalls)
                {
                    fakes.VFXOffset = new Vector2(Main.rand.Next(-2, 2), Main.rand.Next(-2, 2));
                }
            }
        }
예제 #2
0
        public override void AI()
        {
            if (!GotTiles)
            {
                GotTiles = true;

                int range = TBARConfig.tileGrabbyRange;

                int startPosX = (int)Main.screenPosition.X / 16 - range;
                int startPosY = (int)Main.screenPosition.Y / 16 - range;

                int tilesToPickX = Main.screenWidth / 16 + 1 + range;
                int tilesToPickY = Main.screenHeight / 16 + 1 + (int)(range * 1.5f);

                for (int i = startPosX; i < startPosX + tilesToPickX; i++)
                {
                    for (int j = startPosY; j < startPosY + tilesToPickY; j++)
                    {
                        Tile tile = Main.tile[i, j];

                        Color lightColor = Lighting.GetColor(i, j);

                        if (tile.wall != WallID.None)
                        {
                            FakeWalls.Add(new FakeTileData(tile.wall, new Vector2(i * 16, j * 16) - new Vector2(8), new Rectangle(tile.wallFrameX(), tile.wallFrameY(), 36, 36), lightColor));
                        }

                        if (tile.active())
                        {
                            FakeTiles.Add(new FakeTileData(tile.type, new Vector2(i * 16, j * 16), new Rectangle(tile.frameX, tile.frameY, 16, 16), lightColor));
                        }
                    }
                }
            }

            if (projectile.timeLeft == _duration - 25)
            {
                foreach (FakeTileData fakes in FakeTiles)
                {
                    fakes.SetData();
                }

                foreach (FakeTileData fakes in FakeWalls)
                {
                    fakes.SetData();
                }
            }

            if (projectile.timeLeft < _duration - 25)
            {
                foreach (FakeTileData fakes in FakeTiles)
                {
                    fakes.Update();
                }

                foreach (FakeTileData fakes in FakeWalls)
                {
                    fakes.Update();
                }
            }

            if (projectile.timeLeft > _duration - 25 && projectile.timeLeft < _duration)
            {
                foreach (FakeTileData fakes in FakeTiles)
                {
                    fakes.VFXOffset = new Vector2(Main.rand.Next(-2, 2), Main.rand.Next(-2, 2));
                }

                foreach (FakeTileData fakes in FakeWalls)
                {
                    fakes.VFXOffset = new Vector2(Main.rand.Next(-2, 2), Main.rand.Next(-2, 2));
                }
            }
        }