public static int AddLine(Vector2 startPt, Vector2 endPt, Color color) { /* A line between the given points will be drawn. * The returned value represents the hash or name * of the line and should be presented to the * RemoveLine(...) function if the line is to be * removed. * * The returned line hash will NEVER be 0. */ previousLineName += 1; int newLineName = previousLineName; NocabLine newLine = NocabLinePooler.getLine(startPt, endPt, color); lines.Add(newLineName, newLine); return(previousLineName); }
public static bool RemoveLine(int lineName) { /* Removes the line associated with the provided lineName hash. * If no such has exists, or was previously deleted this function * return false. Otherwise, returning true means that the line * was sucesfully removed. */ if (lines.ContainsKey(lineName)) { NocabLine oldLine = lines[lineName]; NocabLinePooler.returnLine(oldLine); lines.Remove(lineName); return(true); } return(false); }