Skip to content

Commit

Permalink
Adds console connect logic to calibration
Browse files Browse the repository at this point in the history
  • Loading branch information
thewithz committed Nov 22, 2020
1 parent 888eb6d commit 0d6f93c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 15 deletions.
7 changes: 4 additions & 3 deletions OdysseyNow/Assets/CalibrationDirectorNew.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,13 @@ private void Start() {
mStepPipe.Add(new S0_2D3DAnimation(this, cameraInGame, camera3DScene));
mStepPipe.Add(new S1_Devices(this));

if (mCalibrationSettings.useOverlay) {
if (mCalibrationSettings.useOverlay)
{
mStepPipe.Add(new S2_Overlay(this, mCalibrationSettings.overlay_extra_text));
}

// if we need read calibration
if (mCalibrationSettings.p1_read || mCalibrationSettings.p2_read) {
if (mCalibrationSettings.p1_read || mCalibrationSettings.p2_read && PlayerPrefs.GetInt("console_connected") == 1) {
// find a player in read mode
var playerReadName = mCalibrationSettings.p1_read ? "P1" : "P2";
Debug.Log("Read mode player: " + playerReadName);
Expand All @@ -72,7 +73,7 @@ private void Start() {
}

// if we need write calibration
if (!mCalibrationSettings.p1_read || !mCalibrationSettings.p2_read) {
if (!mCalibrationSettings.p1_read || !mCalibrationSettings.p2_read && PlayerPrefs.GetInt("console_connected") == 1) {
// find a player in write mode
var playerWriteName = !mCalibrationSettings.p1_read ? "P1" : "P2";

Expand Down
6 changes: 1 addition & 5 deletions OdysseyNow/Assets/ModeDirector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ private void Awake() {
// load cat and mouse after calibration
calibration.GetComponent<CalibrationDirectorNew>().afterCalibration.AddListener(StartCatAndMouse);
break;
case "Super Cat and Mouse":
case "SCAM-Stonehendge":
calibration.GetComponent<CalibrationDirectorNew>().afterCalibration.AddListener(StartSuperCatAndMouse);
break;
case "Haunted House":
Expand All @@ -34,10 +34,6 @@ private void Awake() {
PlayerPrefs.GetString("P1Input"));
var p2Input = (LocalInputManager.ControlScheme) System.Enum.Parse(typeof(LocalInputManager.ControlScheme),
PlayerPrefs.GetString("P2Input"));
// if both input schemes are keyboard or AI, then no need to calibrate overlay
if ((p1Input == LocalInputManager.ControlScheme.Keyboard || p1Input == LocalInputManager.ControlScheme.AI) &&
(p2Input == LocalInputManager.ControlScheme.Keyboard || p2Input == LocalInputManager.ControlScheme.AI))
calibration.GetComponent<CalibrationOdysseySettings>().useOverlay = false;

// if p1 is ai or keyboard, don't read calibration
if (p1Input == LocalInputManager.ControlScheme.AI || p1Input == LocalInputManager.ControlScheme.Keyboard)
Expand Down
4 changes: 2 additions & 2 deletions OdysseyNow/Assets/Scenes/MainMenu.unity
Original file line number Diff line number Diff line change
Expand Up @@ -6318,7 +6318,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
otherMenu: {fileID: 448613491}
gameSelect: {fileID: 0}
connectToggle: {fileID: 0}
connectToggle: {fileID: 1882719786}
--- !u!114 &820210557
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -11469,7 +11469,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
otherMenu: {fileID: 448613491}
gameSelect: {fileID: 0}
connectToggle: {fileID: 0}
connectToggle: {fileID: 1882719786}
--- !u!114 &1499487536
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down
6 changes: 1 addition & 5 deletions OdysseyNow/Assets/Scripts/Graphics/MenuButtonBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ private void ButtonClicked() {
gameSelect.transform.Find(transform.name).gameObject.SetActive(true);
_parent.gameObject.SetActive(false);
}
// if an odyssey is connected but we don't want to play with AI
else if (connectToggle.isOn) {
// pulls up the calibrations scene
SceneManager.LoadScene("Calibration");
}
// if an odyssey is not connected and we don't want to play with AI
else {
// pulls up the card based on the button's name
Expand All @@ -64,6 +59,7 @@ private void ButtonClicked() {
// tells the scene configurer which game to use
PlayerPrefs.SetString("game",
_parent.Find("Game Drop Down").Find("Label").GetComponent<Text>().text);
PlayerPrefs.SetInt("console_connected", connectToggle.isOn ? 1 : 0);
return;
}

Expand Down

0 comments on commit 0d6f93c

Please sign in to comment.