/// <summary> /// Takes the input strings and converts them into a mapping for the object. Whitespaces are ignored and not included. /// /// The input will be internally value rotated so that the output looks the same orientation as normal input reads. /// </summary> /// <param name="input"></param> /// <returns></returns> public void SetGlyphs(Direction dir, int controlX, int controlY, string[] input) { if (input is null) { throw new ArgumentNullException(nameof(input)); } else if (input.Length == 0) { throw new ArgumentException("Cannot set glyphs without input."); } Reps[dir] = new MultiTileRepresentation { ControlPoint = Coord.Get(controlX, controlY) }; for (int y = 0; y < input.Length; y++) { for (int x = 0; x < input[y].Length; x++) { char working = input[y][x]; if (char.IsWhiteSpace(working)) { continue; } Reps[dir].Put(x, y, working, DefaultColor); } } }
public MultiTileRepresentation(MultiTileRepresentation other) { if (other is null) { throw new ArgumentNullException(nameof(other)); } ControlPoint = other.ControlPoint; foreach (var(coord, rep) in other.Tiles) { Tiles[coord] = new Representation(rep); } OuterBounds = new Rectangle(other.OuterBounds.Location, other.OuterBounds.Size); }
public BigMob(BigMob other) { if (other is null) { throw new ArgumentNullException(nameof(other)); } DefaultColor = other.DefaultColor; Location = other.Location; Facing = other.Facing; foreach (var(dir, mtr) in other.Reps) { Reps[dir] = new MultiTileRepresentation(mtr); } Blocking = other.Blocking; }