public static bool CanMove(Entity mover, OrderedPair destination) { // returns true if any entites at the destination position are solid List <Entity> entitesAtDestination = Zone.GetEntitiesAtPosition(destination); foreach (Entity potentialObstacle in entitesAtDestination) { if (potentialObstacle.HasComponent <Solid>()) { return(false); } } return(true); }
/// <summary> /// Draws the entity. If the entity cannot/should not be rendered, it won't be. /// </summary> /// <param name="entity"></param> private static void DrawEntity(Entity entity) { if (!entity.HasComponent <Display>() || !entity.HasComponent <Position>()) { return; } Display display = entity.GetComponent <Display>(); OrderedPair pos = entity.GetComponent <Position>().Pos; if (!display.ShouldRender) { return; } GameManager.DrawSprite(display.TextureName, pos.X, pos.Y, display.Color); }
public static void Move(Entity mover, OrderedPair destination) { mover.GetComponent <Position>().Pos = destination; }