public override void Collide(Collidable obj) { if ((obj == Game1.playerCharacter) && (Game1.locations.TryGetValue(DestinationMap, out Location loc))) { var pos = loc.GetWarpCenterPos(DestinationWarp); pos.X += OffsetPos.X; pos.Y += OffsetPos.Y; if (OffsetPos.X > 0) { pos.X += (int)(collisionBox.Width * 1.5); } else if (OffsetPos.X < 0) { pos.X -= (int)(Game1.playerCharacter.GetCollisionBox().Width * 1.5); } if (OffsetPos.Y > 0) { pos.Y += (int)(collisionBox.Height * 1.5); } else if (OffsetPos.Y < 0) { pos.Y -= (int)(Game1.playerCharacter.GetCollisionBox().Height * 1.5); } Game1.PushEvent(new Fade(false)); Game1.PushEvent(new WarpEvent(DestinationMap, pos)); Game1.PushEvent(new Fade(true)); } }
public override void Interact() { Game1.PushEvent(new Dialogue("I'm so busy... please leave me alone.")); Vector2 c = GetCenterCollisionBox(); int tileX = (int)c.X / Game1.tileSize; int tileY = (int)c.Y / Game1.tileSize; events.Add(new MovePathEvent(location, this, tileX, tileY, (tileX + Game1.gameDateTime.Minute) % location.TileMapW(), (tileY + Game1.gameDateTime.Hour) % location.TileMapH())); }