/// <summary> /// Convert orientation to rotation /// </summary> private static void SetRotation(IPositionedEntity entity, string ori, bool northWestOnly, int ewidth, int eheight) { if (northWestOnly) { if (ori == "east") { ori = "west"; } if (ori == "south") { ori = "north"; } } switch (ori) { case "east": entity.Rotation = 180; break; case "north": entity.Rotation = 270; // Adjust for rotation around center entity.X -= (ewidth - eheight) / 2; entity.Y += (ewidth - eheight) / 2; break; case "south": entity.Rotation = 90; // Adjust for rotation around center entity.X -= (ewidth - eheight) / 2; entity.Y += (ewidth - eheight) / 2; break; } }
/// <summary> /// Convert orientation to rotation /// </summary> private static void SetRotation(IPositionedEntity entity, string ori, int ewidth, int eheight) { switch (ori) { case "180": entity.Rotation = 180; break; case "90": entity.Rotation = 270; // Adjust for rotation around center entity.X -= (ewidth - eheight) / 2; entity.Y += (ewidth - eheight) / 2; break; case "270": entity.Rotation = 90; // Adjust for rotation around center entity.X -= (ewidth - eheight) / 2; entity.Y += (ewidth - eheight) / 2; break; } }
public CharacterLikeMovement(ICharacterLikeMovement entity, IPositionedEntity posEnt) { _host = entity; _posEnt = posEnt; LocalPosition = _posEnt.Position; }
/// <summary> /// Try to get the module item showing the given module /// </summary> internal IPositionedEntityItem GetItem(IPositionedEntity entity) { return(Items.Select(placement => placement.Item as IPositionedEntityItem).FirstOrDefault(item => (item != null) && (item.Entity == entity))); }
/// <summary> /// Try to get the module item showing the given module /// </summary> internal IPositionedEntityItem GetItem(IPositionedEntity entity) { return(positionedEntities.GetItem(entity)); }