コード例 #1
0
        public override void AI()
        {
            int  hostX    = (int)projectile.position.X / 16;
            int  hostY    = (int)projectile.position.Y / 16;
            Tile hostTile = Main.tile[hostX, hostY];

            if (Main.player.Any(p => AbilityHelper.CheckWisp(p, projectile.Hitbox)) && hostTile.frameX == 0)
            {
                for (int k = 0; k < 40; k++)
                {
                    Dust.NewDustPerfect(projectile.Center, ModContent.DustType <Dusts.Gold2>(), Vector2.One.RotatedByRandom(6.28f) * Main.rand.NextFloat(1.2f, 1.4f));
                }

                for (int x = hostX; x <= hostX + 1; x++)
                {
                    for (int y = hostY; y <= hostY + 1; y++)
                    {
                        Main.tile[x, y].frameX += 34;
                    }
                }

                Main.NewText("Harvest!");
            }
            projectile.timeLeft = 2;

            if (hostTile.type != ModContent.TileType <Tiles.Overgrow.BulbFruit>())
            {
                projectile.timeLeft = 0;
            }
        }
コード例 #2
0
ファイル: BulbFruit.cs プロジェクト: Seraph-ED/StarlightRiver
        public override void Collision(Player player)
        {
            Tile tile = Main.tile[ParentX - 1, ParentY - 1];

            if (tile.frameX == 0 && tile.frameY == 0 && AbilityHelper.CheckWisp(player, projectile.Hitbox))
            {
                for (int k = 0; k < 40; k++)
                {
                    Dust.NewDustPerfect(projectile.Center, DustType <Content.Dusts.GoldWithMovement>(), Vector2.One.RotatedByRandom(6.28f) * Main.rand.NextFloat(1.2f, 1.4f));
                }
                tile.frameX = 34;
            }
        }