public PathFindController(Character c, GameLocation location, PathFindController.isAtEnd endFunction, int finalFacingDirection, bool eraseOldPathController, PathFindController.endBehavior endBehaviorFunction, int limit, Point endPoint) { this.limit = limit; this.character = c; if (c is NPC && (c as NPC).CurrentDialogue.Count > 0 && (c as NPC).CurrentDialogue.Peek().removeOnNextMove) { (c as NPC).CurrentDialogue.Pop(); } this.location = location; this.endFunction = endFunction == null ? new PathFindController.isAtEnd(PathFindController.isAtEndPoint) : endFunction; this.endBehaviorFunction = endBehaviorFunction; if (endPoint == Point.Zero) { endPoint = new Point((int)c.getTileLocation().X, (int)c.getTileLocation().Y); } this.finalFacingDirection = finalFacingDirection; if (!(this.character is NPC) && !Game1.currentLocation.Name.Equals(location.Name) && (endFunction == new PathFindController.isAtEnd(PathFindController.isAtEndPoint) && endPoint.X > 0) && endPoint.Y > 0) { this.character.position = new Vector2((float)(endPoint.X * Game1.tileSize), (float)(endPoint.Y * Game1.tileSize - Game1.tileSize / 2)); } else { this.pathToEndPoint = PathFindController.findPath(new Point((int)c.getTileLocation().X, (int)c.getTileLocation().Y), endPoint, endFunction, location, this.character, limit); if (this.pathToEndPoint != null) { return; } FarmHouse farmHouse = location as FarmHouse; } }
public PathFindController(Character c, GameLocation location, isAtEnd endFunction, int finalFacingDirection, bool eraseOldPathController, endBehavior endBehaviorFunction, int limit, Point endPoint, bool clearMarriageDialogues = true) { this.limit = limit; character = c; NPC npc = c as NPC; if (npc != null && npc.CurrentDialogue.Count > 0 && npc.CurrentDialogue.Peek().removeOnNextMove) { npc.CurrentDialogue.Pop(); } if (npc != null && clearMarriageDialogues) { if (npc.currentMarriageDialogue.Count > 0) { npc.currentMarriageDialogue.Clear(); } npc.shouldSayMarriageDialogue.Value = false; } this.location = location; this.endFunction = ((endFunction == null) ? new isAtEnd(isAtEndPoint) : endFunction); this.endBehaviorFunction = endBehaviorFunction; if (endPoint == Point.Zero) { endPoint = new Point((int)c.getTileLocation().X, (int)c.getTileLocation().Y); } this.finalFacingDirection = finalFacingDirection; if (!(character is NPC) && !isPlayerPresent() && endFunction == new isAtEnd(isAtEndPoint) && endPoint.X > 0 && endPoint.Y > 0) { character.Position = new Vector2(endPoint.X * 64, endPoint.Y * 64 - 32); return; } pathToEndPoint = findPath(new Point((int)c.getTileLocation().X, (int)c.getTileLocation().Y), endPoint, endFunction, location, character, limit); if (pathToEndPoint == null) { _ = (location is FarmHouse); } }