public void ExitStairwell(Stairwell stairwell) { if (stairwell == this.stairwell) { this.stairwell = null; } }
void OnTriggerExit2D(Collider2D other) { Stairwell stairwell = other.GetComponent <Stairwell>(); if (stairwell) { move.ExitStairwell(stairwell); } }
private void findLowerStairWell() { if (pType == PieceType.LOBBY || pType == PieceType.WALL) { return; } Transform sprite = this.gameObject.transform.Find("Sprite"); GameObject thisStairWell = sprite.Find("Stairwell").gameObject; Stairwell sourceSW = thisStairWell.GetComponent <Stairwell>(); RaycastHit2D hit = Physics2D.Raycast(thisStairWell.transform.position - new Vector3(0, 2.5f, 0), Vector2.down, 500f, layerMask); Debug.DrawRay(thisStairWell.transform.position - new Vector3(0, 2.5f, 0), Vector2.down, Color.magenta, 10f); if (hit.collider != null) { GameObject target = hit.collider.gameObject; Stairwell targetSW = target.GetComponent <Stairwell>(); targetSW.stairwellAbove = sourceSW.transform; sourceSW.stairwellBelow = targetSW.transform; } }
// Stairwell stuff. public void SetStairwell(Stairwell stairwell) { this.stairwell = stairwell; }