public override void behaviorAtGameTick(GameTime time)
{
base.behaviorAtGameTick(time);
this.isEmoting = false;
Microsoft.Xna.Framework.Rectangle boundingBox = this.GetBoundingBox();
if (this.sprite.currentFrame < 4)
{
boundingBox.Inflate(Game1.tileSize * 2, Game1.tileSize * 2);
if (!this.isInvisible || boundingBox.Contains(Game1.player.getStandingX(), Game1.player.getStandingY()))
{
if (this.isInvisible)
{
if (Game1.currentLocation.map.GetLayer("Back").Tiles[(int)Game1.player.getTileLocation().X, (int)Game1.player.getTileLocation().Y].Properties.ContainsKey("NPCBarrier") || !Game1.currentLocation.map.GetLayer("Back").Tiles[(int)Game1.player.getTileLocation().X, (int)Game1.player.getTileLocation().Y].TileIndexProperties.ContainsKey("Diggable") && Game1.currentLocation.map.GetLayer("Back").Tiles[(int)Game1.player.getTileLocation().X, (int)Game1.player.getTileLocation().Y].TileIndex != 0)
{
return;
}
this.position = new Vector2(Game1.player.position.X, Game1.player.position.Y + (float)Game1.player.sprite.spriteHeight - (float)this.sprite.spriteHeight);
Game1.playSound(nameof(Duggy));
this.sprite.interval = 100f;
this.position = Game1.player.getTileLocation() * (float)Game1.tileSize;
}
this.isInvisible = false;
this.sprite.AnimateDown(time, 0, "");
}
}
if (this.sprite.currentFrame >= 4 && this.sprite.CurrentFrame < 8)
{
if (!this.hasDugForTreasure)
{
this.getTileLocation();
}
boundingBox.Inflate(-Game1.tileSize * 2, -Game1.tileSize * 2);
Game1.currentLocation.isCollidingPosition(boundingBox, Game1.viewport, false, 8, false, (Character)this);
this.sprite.AnimateRight(time, 0, "");
this.sprite.interval = 220f;
}
if (this.sprite.currentFrame >= 8)
{
this.sprite.AnimateUp(time, 0, "");
}
if (this.sprite.currentFrame < 10)
{
return;
}
this.isInvisible = true;
this.sprite.currentFrame = 0;
this.hasDugForTreasure = false;
int num = 0;
Vector2 tileLocation1 = this.getTileLocation();
Game1.currentLocation.map.GetLayer("Back").Tiles[(int)tileLocation1.X, (int)tileLocation1.Y].TileIndex = 0;
Game1.currentLocation.removeEverythingExceptCharactersFromThisTile((int)tileLocation1.X, (int)tileLocation1.Y);
for (Vector2 tileLocation2 = new Vector2((float)(Game1.player.GetBoundingBox().Center.X / Game1.tileSize + Game1.random.Next(-12, 12)), (float)(Game1.player.GetBoundingBox().Center.Y / Game1.tileSize + Game1.random.Next(-12, 12))); num < 4 && ((double)tileLocation2.X <= 0.0 || (double)tileLocation2.X >= (double)Game1.currentLocation.map.Layers[0].LayerWidth || ((double)tileLocation2.Y <= 0.0 || (double)tileLocation2.Y >= (double)Game1.currentLocation.map.Layers[0].LayerHeight) || (Game1.currentLocation.map.GetLayer("Back").Tiles[(int)tileLocation2.X, (int)tileLocation2.Y] == null || Game1.currentLocation.isTileOccupied(tileLocation2, "") || (!Game1.currentLocation.isTilePassable(new Location((int)tileLocation2.X, (int)tileLocation2.Y), Game1.viewport) || tileLocation2.Equals(new Vector2((float)(Game1.player.getStandingX() / Game1.tileSize), (float)(Game1.player.getStandingY() / Game1.tileSize))))) || (Game1.currentLocation.map.GetLayer("Back").Tiles[(int)tileLocation2.X, (int)tileLocation2.Y].Properties.ContainsKey("NPCBarrier") || !Game1.currentLocation.map.GetLayer("Back").Tiles[(int)tileLocation2.X, (int)tileLocation2.Y].TileIndexProperties.ContainsKey("Diggable") && Game1.currentLocation.map.GetLayer("Back").Tiles[(int)tileLocation2.X, (int)tileLocation2.Y].TileIndex != 0)); ++num)
{
tileLocation2 = new Vector2((float)(Game1.player.GetBoundingBox().Center.X / Game1.tileSize + Game1.random.Next(-2, 2)), (float)(Game1.player.GetBoundingBox().Center.Y / Game1.tileSize + Game1.random.Next(-2, 2)));
}
}