public SCR_Level GetLevelFromDirection(DIRECTION direction) { SCR_Level result = null; if (!isBlocked) { switch (direction) { case DIRECTION.Up: { if (up != null && !up.isBlocked) { result = up; } } break; case DIRECTION.Down: { if (down != null && !down.isBlocked) { result = down; } } break; case DIRECTION.Left: { if (left != null && !left.isBlocked) { result = left; } } break; case DIRECTION.Right: { if (right != null && !right.isBlocked) { result = right; } } break; } } return(result); }
private void Start() { myRigidbody = GetComponent <Rigidbody>(); if (myRenderer == null) { myRenderer = GetComponent <Renderer>(); } levelProperties = FindObjectOfType <SCR_Level>(); timer = FindObjectOfType <SCR_Timer>(); AssignRandomColor(); winMenu.SetActive(false); lostMenu.SetActive(false); source = GetComponent <AudioSource>(); source.playOnAwake = false; source.loop = false; }
protected void DrawLine(SCR_Level pin) { Gizmos.color = Color.blue; Gizmos.DrawLine(transform.position, pin.transform.position); }