private void CreateBeam(Vector3Int current, Vector3Int dir, MirrorAngle a = MirrorAngle.none) { LaserBeam beam = GetBeamFromPool(); beam.transform.position = _navigation.CellToWorld(current); if (a != MirrorAngle.none) { beam.SetAngle(a); } else { beam.SetOrientation(dir); } //Force check to fix race-condition things. beam.ManualInitiate(puzzleManager); }
public void SetAngle(MirrorAngle angle) { //turn RightUp into like, the laser at a 45 degree angle. verticalBeamVisuals.SetActive(true); horizontalBeamVisuals.SetActive(true); }
private Vector3Int InToOut(MirrorAngle angle, Vector3Int laserInDir) { switch (angle) { case MirrorAngle.RightUp: if (laserInDir == Vector3Int.right) { return(Vector3Int.up); } if (laserInDir == Vector3Int.up) { return(Vector3Int.right); } break; case MirrorAngle.RightDown: if (laserInDir == Vector3Int.right) { return(Vector3Int.down); } if (laserInDir == Vector3Int.down) { return(Vector3Int.right); } break; case MirrorAngle.LeftUp: if (laserInDir == Vector3Int.left) { return(Vector3Int.up); } if (laserInDir == Vector3Int.up) { return(Vector3Int.left); } break; case MirrorAngle.LeftDown: if (laserInDir == Vector3Int.left) { return(Vector3Int.down); } if (laserInDir == Vector3Int.down) { return(Vector3Int.left); } break; case MirrorAngle.HorizontalPass: if (laserInDir == Vector3Int.left) { return(Vector3Int.right); } if (laserInDir == Vector3Int.right) { return(Vector3Int.left); } break; case MirrorAngle.VerticalPass: if (laserInDir == Vector3Int.down) { return(Vector3Int.up); } if (laserInDir == Vector3Int.up) { return(Vector3Int.down); } break; default: //throw new ArgumentOutOfRangeException(); return(Vector3Int.zero); } return(Vector3Int.zero); }