private void placeTile(Vector2 startPos, Vector2 endPos) { if (!this.isValidPos(startPos) || !isValidPos(endPos)) { return; //Invalid input } if (this.isAllSameTile(startPos, endPos)) { return; //Noting to place here } Command c = new PlaceTileCommand(prefabPath, tileScale, map, layer, startPos, endPos); commandStack.perform(c); }
private void eraseTile(Vector2 startPos, Vector2 endPos) { if (!isValidPos(startPos) || !isValidPos(endPos)) { return; //Invalid Coordinate } foreach (MapLayer layer in Enum.GetValues(typeof(MapLayer))) { if (!hasTilesToDelete(layer, startPos, endPos)) { return; //Nothing to delete } Command c = new PlaceTileCommand("", Vector3.one, map, layer, startPos, endPos); commandStack.perform(c); } }