void OnTriggerEnter2D(Collider2D other) { if (other.isTrigger == false) { Unit_local touchedUnit = other.GetComponent <Unit_local>(); if (touchedUnit != null && other.name.Contains("sheep") == false) { if (Input.GetButton("modifier") == false) { Cohort maybeOn = touchedUnit.cohort; bool lightsOn = true; foreach (Unit_local inQuestion in candidates) { if (inQuestion.cohort.Equals(maybeOn)) { lightsOn = false; } } if (lightsOn == true) { maybeOn.Highlight(); } } else { touchedUnit.Highlight(); } candidates.Add(touchedUnit); } } }
void Update() { if (unitUnderMouse != null) { if (Input.GetButtonDown("modifier") && rectManager.rectOn == false) { unitUnderMouse.cohort.HighlightOff(); unitUnderMouse.Highlight(); } if (Input.GetButtonUp("modifier") && rectManager.rectOn == false) { unitUnderMouse.cohort.Highlight(); } } }
public void addToPalette(Unit_local underMouse) { unitUnderMouse = underMouse; if (rectManager.rectOn == false) { if (Input.GetButton("modifier") == false) { unitUnderMouse.cohort.Highlight(); } else { unitUnderMouse.Highlight(); } } }