Skip to content

Commit

Permalink
uses joystick inputs now (button 1 to launch).
Browse files Browse the repository at this point in the history
  • Loading branch information
poemdexter committed Jul 9, 2014
1 parent 9e177fd commit 2044f40
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 6 deletions.
Binary file modified Assets/Scenes/launcher.unity
Binary file not shown.
44 changes: 38 additions & 6 deletions Assets/Scripts/CaroselWheel.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Prime31.GoKitLite;
using UnityEngine;
using System.Collections;
Expand All @@ -25,9 +26,16 @@ private void Start()
{
DataLoader dl = new DataLoader();
List<GameAsset> assets = dl.GetGameAssetsList();
InstantiateGames(assets);
SetUpGamesAtStart();
UpdateData();
if (!assets.Any())
{
title.text = "No Games Found";
}
else
{
InstantiateGames(assets);
SetUpGamesAtStart();
UpdateData();
}
}

private void InstantiateGames(List<GameAsset> a)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 2044f40

Please sign in to comment.