void OnTriggerExit(Collider other) { SegmentStreamer.Broadcast(SegmentEvent.TriggerExit, other.gameObject, this); if (!other.name.Equals("PlayerObject")) { return; } if (_playerObject.CurrentSegments.Contains(this)) { _playerObject.CurrentSegments.Remove(this); } foreach (GameObject seg in _currentSegments) { if (seg.Equals(this.gameObject) || LinkedSegments.Contains(seg)) { continue; } else { // seg.SetActive(false); } } }
void OnTriggerEnter(Collider other) { SegmentStreamer.Broadcast(SegmentEvent.TriggerEnter, other.gameObject, this); if (!other.name.Equals("PlayerObject")) { return; } if (!_playerObject.CurrentSegments.Contains(this)) { _playerObject.CurrentSegments.Add(this); } foreach (GameObject linkedSeg in LinkedSegments) { if (_currentSegments.Contains(linkedSeg)) { continue; } else { //Instantiate(linkedSeg); // load linked segments linkedSeg.SetActive(true); } } foreach (GameObject seg in _currentSegments) { if (seg.Equals(this.gameObject) || LinkedSegments.Contains(seg)) { continue; } else { seg.SetActive(false); } } }
void OnCollisionEnter(Collision other) => SegmentStreamer.Broadcast(SegmentEvent.CollisionEnter, other.gameObject, this);