private void OnTriggerEnter2D(Collider2D collider) { CameraSegmentMember member = collider.GetComponent <CameraSegmentMember>(); if (member) { OnMemberEnter(member); } PlayerUnitController unit = InteractiveHelpers.GetPlayer(collider); if (!unit) { return; } PlayerUnitCamera playerCamera = unit.di.camera; if (playerCamera.CameraSegment == null) { unitsInside.Add(unit); playerCamera.CameraSegment = this; } else { CheckUnitForSegmentEnter(unit); } }
private void OnTriggerExit2D(Collider2D collider) { CameraSegmentMember member = collider.GetComponent <CameraSegmentMember>(); if (member) { OnMemberExit(member); } PlayerUnitController unit = InteractiveHelpers.GetPlayer(collider); if (!unit) { return; } unitsInside.Remove(unit); // TODO: do we need to assign null here? //PlayerUnitCamera camera = unit.di.camera; //if (camera.CameraSegment == this) // camera.CameraSegment = null; //camera.RemoveCameraSegment(this); }
private void OnMemberExit(CameraSegmentMember member) { members.Remove(member); if (member.Segment == this) { member.Segment = null; } }
private void OnMemberEnter(CameraSegmentMember member) { members.Add(member); member.Segment = this; }