Skip to content

Commit

Permalink
added the hold down of start to quit out of game
Browse files Browse the repository at this point in the history
  • Loading branch information
boland25 committed Sep 9, 2019
1 parent bfbac61 commit 2c79961
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
12 changes: 12 additions & 0 deletions QPong-Python-Server/flask_server/qpong_start_server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh
# qpong start server.sh
#
#
# Created by boland on 9/7/19.
#
# dont forget to give the mac permissions to run this
# Run chmod u+x ~/Desktop/myCommandScript.command

# TODO: change the path to this when you put it on the arcade
cd ~/Projects/QuantumArcade/QPong/QPong-Unity/QPong-Python-Server/flask_server
python3 server.py
30 changes: 28 additions & 2 deletions QPong-Unity-Version/Assets/Scripts/Menu/MenuController.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;

public class MenuController : MonoBehaviour
{
public int timeToExit = 10;

bool startWasPressed = false;
float startButtonPressCount = 0f;
private ArcadeAPIController arcadeAPIController;

private void Awake() {
Expand All @@ -20,8 +22,32 @@ private void Awake() {
void Update()
{
//Player needs to hit the Start button to start the game instead of any button
if (Input.GetButtonDown("Start")) {
GameController.Instance.StartGame();
if (Input.GetButtonDown("Start"))
{
//the game or maybe even close it out and go back to the app selection screen
startButtonPressCount = Time.time;
print("Start button press " + startButtonPressCount);

}
if (Input.GetButtonUp("Start"))
{

startButtonPressCount = Math.Abs(Time.time - startButtonPressCount);

print("time down " + startButtonPressCount);

if (startButtonPressCount >= 3.0f)
{
print("QUIT APP!!");
startButtonPressCount = 0f;

System.Diagnostics.Process.Start("osascript", "-e 'tell application \"AppMenu\" to activate'");
Application.Quit();
}else
{
GameController.Instance.StartGame();
}
startButtonPressCount = 0f;
}
}

Expand Down

0 comments on commit 2c79961

Please sign in to comment.