diff --git a/Assets/Scenes/launcher.unity b/Assets/Scenes/launcher.unity index c41a0f3..130accd 100644 Binary files a/Assets/Scenes/launcher.unity and b/Assets/Scenes/launcher.unity differ diff --git a/Assets/Scripts/CaroselWheel.cs b/Assets/Scripts/CaroselWheel.cs index 2e26b96..0a2304a 100644 --- a/Assets/Scripts/CaroselWheel.cs +++ b/Assets/Scripts/CaroselWheel.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Linq; using Prime31.GoKitLite; using UnityEngine; using System.Collections; @@ -25,9 +26,16 @@ private void Start() { DataLoader dl = new DataLoader(); List assets = dl.GetGameAssetsList(); - InstantiateGames(assets); - SetUpGamesAtStart(); - UpdateData(); + if (!assets.Any()) + { + title.text = "No Games Found"; + } + else + { + InstantiateGames(assets); + SetUpGamesAtStart(); + UpdateData(); + } } private void InstantiateGames(List a) @@ -67,22 +75,46 @@ private void SetUpGamesAtStart() private void Update() { - if (currentPosition > 0 && Input.GetKeyDown(KeyCode.LeftArrow)) // move to left game + if (currentPosition > 0 && GetKeyInputLeft()) // move to left game { ShiftTilesRight(currentPosition); UpdateData(); } - else if (currentPosition < games.Length - 1 && Input.GetKeyDown(KeyCode.RightArrow)) // move to right game + else if (currentPosition < games.Length - 1 && GetKeyInputRight()) // move to right game { ShiftTilesLeft(currentPosition); UpdateData(); } - else if (Input.GetKeyDown(KeyCode.Return)) + else if (GetKeyInputButton1()) { LaunchGame(); } } + private bool GetKeyInputLeft() + { + return Input.GetButtonDown("P1_Left") + || Input.GetButtonDown("P2_Left") + || Input.GetButtonDown("P3_Left") + || Input.GetButtonDown("P4_Left"); + } + + private bool GetKeyInputRight() + { + return Input.GetButtonDown("P1_Right") + || Input.GetButtonDown("P2_Right") + || Input.GetButtonDown("P3_Right") + || Input.GetButtonDown("P4_Right"); + } + + private bool GetKeyInputButton1() + { + return Input.GetButtonDown("P1_Button1") + || Input.GetButtonDown("P2_Button1") + || Input.GetButtonDown("P3_Button1") + || Input.GetButtonDown("P4_Button1"); + } + private void ShiftTilesRight(int current) { if (currentPosition - 1 >= 0)