private void Finish(bool isUnit, Unit unit, Vector2 pos) { if (!Active) { Debug.LogError("Finish was called when not active!"); return; } Active = false; if (this.output != null) { this.output.Invoke(isUnit, unit, pos); this.output = null; } else { Debug.LogError("Output is null when finish was called."); } }
public void GetSelection(SelectionOutput t, bool allowPositions, bool allowUnits) { if (Active) { Debug.LogError("Unit or pos selection is already active, cannot use right now!"); return; } if (t == null) { Debug.LogError("The selection output parameter was null."); return; } if (!allowPositions && !allowUnits) { Debug.LogError("You must allow either positions or units, or both, to run this selection query. Ignored."); return; } this.output = t; this.AllowPositions = allowPositions; this.AllowUnits = allowUnits; Active = true; }