void OnTriggerEnter2D(Collider2D other) { if (ouHeld != null) { if (other.gameObject.layer == nestLayer && ouHeld.pairColor == other.GetComponent <Nest>().pairColor) { couldHatch = true; } } else if (other.gameObject.layer == ouLayer) { Ou otherOu = other.GetComponent <Ou>(); if (!otherOu.isHeld) { if (otherOu.owner == null || otherOu.owner == this) { if (hatchlingHeld == null) { ouHeld = otherOu; ouHeld.GrabHold(this); ouHeld.transform.localPosition = carryPosition; } } else { Destroy(other.gameObject); if (stunIndicatorInProgress == null) { stunIndicatorInProgress = Instantiate(stunIndicator, transform, false).GetComponent <StunIndicator>(); stunIndicatorInProgress.player = this; } if (hatchlingHeld != null) { Destroy(hatchlingHeld.gameObject); hatchlingHeld = null; } } } } if (hatchlingHeld != null) { if (other.gameObject.layer == houseLayer) { if (other.GetComponent <House>().pairColor == hatchlingHeld.pairColor) { score += scoreGainOnMatching; } else { score += scoreGainOnNonmatching; } Destroy(hatchlingHeld.gameObject); hatchlingHeld = null; } } }
internal void StunOver() { stunIndicatorInProgress = null; }