void OnTriggerEnter2D(Collider2D other) { if (ArcadePhysics.SameWorld(this, other)) { // only trigger if this component is on if (enabled) { // and now it's time to stop the level FinalizeLevel.CrossFinishLine(clock.GetTime()); } } }
void OnTriggerEnter2D(Collider2D other) { if (ArcadePhysics.SameWorld(this, other)) { // only trigger if this component is on if (enabled) { // the timer is stopped when a player touches the line // idempotent, so don't worry about calling it more than once clock.StopTiming(); } } }
void OnTriggerEnter2D(Collider2D other) { if (ArcadePhysics.SameWorld(this, other)) { if (enabled) { // the game ends when the player touches the exit portal if (other.gameObject.CompareTag(Magic.Tags.PLAYER)) { FinalizeLevel.FinishGame(); } } } }
void OnTriggerEnter2D(Collider2D other) { if (ArcadePhysics.SameWorld(this, other)) { // only trigger if this component is on if (enabled) { if (!started) { started = true; } } } }
void OnTriggerEnter2D(Collider2D other) { if (ArcadePhysics.SameWorld(this, other)) { if (enabled) // only trigger if this component is on // start the clock the first time a player comes through! { if (other.gameObject.CompareTag(Magic.Tags.PLAYER)) { clock.StartTiming(); } } } }
void OnTriggerEnter2D(Collider2D other) { if (ArcadePhysics.SameWorld(this, other)) { // only trigger if this component is on if (enabled) { ++isColliding; if (isColliding == 1) // first presser! { plate.Press(); } } } }
void OnTriggerEnter2D(Collider2D other) { if (ArcadePhysics.SameWorld(this, other)) { // only trigger if this component is on if (enabled) { // if the key collides with another game object that has a // KeyHolder component that isn't already holding a key object, KeyHolder holder = other.gameObject.GetComponent <KeyHolder> (); if (holder != null && holder.CanPickupKey()) { // then mark that object as holding a key and deactivate self holder.PickupKey(); key.Pickup(); } } } }
void OnTriggerEnter2D(Collider2D other) { if (ArcadePhysics.SameWorld(this, other)) { if (enabled) // only trigger if this component is on // start the clock the first time a player comes through! { if (other.gameObject.CompareTag(Magic.Tags.PLAYER)) { // Send an update saying the clock has started if (updateManager != null) { updateManager.SendStartClock(); } } } } }
void OnTriggerExit2D(Collider2D other) { if (ArcadePhysics.SameWorld(this, other)) { // only trigger if this component is on if (enabled) { --isColliding; if (isColliding < 0) // clamp at zero { isColliding = 0; } if (isColliding == 0) // last releaser! { plate.Release(); } } } }
void OnTriggerEnter2D(Collider2D other) { if (ArcadePhysics.SameWorld(this, other)) { // only trigger if this component is on and // inside the same physics layer if (enabled) { // if the block collides with another game object that has a // KeyHolder component that is holding a key object, KeyHolder holder = other.gameObject.GetComponent <KeyHolder> (); if (holder != null && holder.IsHoldingKey()) { // open (deactivate self) and mark the object as no longer // holding a key block.Open(); holder.DropKey(); } } } }