protected override void assignPlayerNameToUI() { currentStatus cs = saveController.loadStatus(); scoreUI[2].text = cs.playerNames[0]; scoreUI[0].text = (instedElements[1].GetComponent <scoreContaint>().getScore()).ToString(); }
////////////////////////////////////// // [ STEP 2 ] PLACE TOKENS: We look for the spots where we need to add the token than than we generate the tokens at those positions void placeTokens(int[,] theCurrArray) { int theNumRows = (theCurrArray.Length / 8); //Check each Entry in the table and we print it out for (int theRow = 0; theRow < theNumRows; theRow++) { for (int incre = 0; incre < 8; incre++) { //print(theCurrArray[theRow,incre]); switch (theCurrArray[theRow, incre]) { case 1: //We place a white token generateTokens(theRow, incre, theCurrArray[theRow, incre]); break; case 2: //We place a black token generateTokens(theRow, incre, theCurrArray[theRow, incre]); break; } //end Switch } //End for loop } //End Row For loop //We are done creating the map so we give the greenlight theCurrentStatus = currentStatus.taskComplete; } //end FCT
void inhubcorrutine() { if (lives == 0) { /// elimina escenario actual /// genera el lose Destroy(GameObject.FindGameObjectWithTag("game")); swIntTransition = true; Instantiate(transitionGameOver); actualCurrentStatus = currentStatus.inGameOver; // yield return new WaitForSeconds (1); } else { // generar el minijuego y elimina transicion actual verifyFase(); miniGameStatus = true; Destroy(GameObject.FindGameObjectWithTag("transition")); int randomID = Random.Range(0, miniGameFactory.Length); previousMinigame = randomID; GameObject timer = GameObject.FindGameObjectWithTag("timer"); timer.GetComponent <timeController> ().setMaxValue(timersMiniGame[randomID]); timer.GetComponent <timeController> ().clearTimer(); Instantiate(miniGameFactory[randomID]); actualCurrentStatus = currentStatus.inMiniGame; endMiniGame = false; // yield return new WaitForSeconds (1); } }
public void initGame() { Destroy(GameObject.FindGameObjectWithTag("game")); Destroy(GameObject.FindGameObjectWithTag("transition")); swControl = true; score = 0; highScore = PlayerPrefs.GetInt("HighScore"); lives = 4; miniGameStatus = true; subfase = 0; faseActual = 0; fases = new fase[4]; fases [0] = new fase(1, 1, 1); fases [1] = new fase(1, 1, 1); fases [2] = new fase(1, 1, 1); fases [3] = new fase(1, 1, 1); actualCurrentStatus = currentStatus.inStartGame; // Clean Strings setQuote(); previousMinigame = -1; currentMinigame = -1; Debug.Log("estart"); swIntTransition = true; Instantiate(transitionStartGame); }
private void loadHelpScene() { currentStatus cs = new currentStatus(); cs.sceneName = "help"; saveController.saveStatus(cs); Application.LoadLevel("help"); }
private void loadInputName2Player() { currentStatus cs = new currentStatus(); cs.sceneName = "2player1device"; saveController.saveStatus(cs); Application.LoadLevel("inputName2Player"); }
protected override void updateScoreUI() { currentStatus cs = saveController.loadStatus(); for (int i = 0; i < 2; i++) { scoreUI[i].text = (instedElements[i].GetComponent <scoreContaint>().getScore()).ToString(); } }
public static void saveStatus(currentStatus cs) { BinaryFormatter formatter = new BinaryFormatter(); string path = Application.persistentDataPath + "/save.pong"; FileStream stream = new FileStream(path, FileMode.Create); formatter.Serialize(stream, cs); stream.Close(); }
public static currentStatus loadStatus() { BinaryFormatter formatter = new BinaryFormatter(); string path = Application.persistentDataPath + "/save.pong"; FileStream stream = new FileStream(path, FileMode.Open); currentStatus cs = formatter.Deserialize(stream) as currentStatus; stream.Close(); return(cs); }
private void loadGame() { currentStatus cs = saveController.loadStatus(); if (cs.sceneName == "1player1device") { Application.LoadLevel("1player1device"); } else if (cs.sceneName == "2player1device") { Application.LoadLevel("2player1device"); } }
public void loadInputName() { currentStatus cs = saveController.loadStatus(); if (cs.sceneName == "1player1device") { Application.LoadLevel("inputName1Player"); } else if (cs.sceneName == "2player1device") { Application.LoadLevel("inputName2Player"); } }
void inTransitionLoseCorrutine() { if (!swIntTransition) { actualCurrentStatus = currentStatus.inHub; } else { Debug.Log("No termino la transicion del lose"); } /// generar animacion lose // actualCurrentStatus = currentStatus.inHub; // yield return new WaitForSeconds (1); }
void startGameTransition() { //generar prefab animation start generar piso personas y inicia correr if (!swIntTransition) { actualCurrentStatus = currentStatus.inHub; } else { Debug.Log("En Animacion"); } // yield return new WaitForSeconds (1); }
public void disableTutorial() { currentStatus cs = saveController.loadStatus(); if (!(cs.help)) { gameObject.SetActive(false); } else if (Input.touches.Length > 0 || Input.GetMouseButtonDown(0)) { cs.help = false; saveController.saveStatus(cs); gameObject.SetActive(false); } }
private void loadGameWithHelp() { currentStatus cs = saveController.loadStatus(); cs.help = true; saveController.saveStatus(cs); if (cs.sceneName == "1player1device") { Application.LoadLevel("1player1device"); } else if (cs.sceneName == "2player1device") { Application.LoadLevel("2player1device"); } }
//----------------------------------------------------------------------------------------------------------------------- // Use this for initialization public void initMe() { //Resets the data in the table softReset(); //Set the base Blocks Positions setDefaultBlocks(); //Creates the field. makeField(); //We generate the blocks //generateField(); //We say that the task is complete . theCurrentStatus = currentStatus.taskComplete; }
private void activeHelpUI() { currentStatus cs = new currentStatus(); if (cs.sceneName == "1player1device") { leftPaddle = GameObject.Find("leftPaddle(Clone)"); if (leftPaddle.transform.position.z <= 0) { leftRingForBottomPositionOfPaddle.SetActive(true); } else { leftRingForTopPositionOfPaddle.SetActive(true); } leftLose.SetActive(true); move.SetActive(true); } else if (cs.sceneName == "2player1device") { leftPaddle = GameObject.Find("leftPaddle(Clone)"); rightPaddle = GameObject.Find("rightPaddle(Clone)"); if (leftPaddle.transform.position.z <= 0) { leftRingForBottomPositionOfPaddle.SetActive(true); } else { leftRingForTopPositionOfPaddle.SetActive(true); } if (rightPaddle.transform.position.z <= 0) { rightRingForBottomPositionOfPaddle.SetActive(true); } else { rightRingForTopPositionOfPaddle.SetActive(true); } leftLose.SetActive(true); rightLose.SetActive(true); move.SetActive(true); } }
protected override void loadLastStatus() { currentStatus cs = saveController.loadStatus(); if (cs.inGame) { instedElements[2].transform.position = new Vector3(cs.sphere[0], instedElements[2].transform.position.y, cs.sphere[1]); instedElements[2].transform.eulerAngles = new Vector3(0, 0, 0); instedElements[2].transform.Rotate(0, cs.sphere[2], 0); instedElements[1].transform.position = new Vector3(instedElements[1].transform.position.x, instedElements[1].transform.position.y, cs.paddles[1]); instedElements[1].GetComponent <scoreContaint>().setScore(cs.score[1]); base.startTime = cs.startTime + (Time.time - cs.pauseTime); updateScoreUI(); } cs.inGame = false; }
//==========WHAT WILL U DO?===================\\ //0. By default we will set the player to black √ //1. Scan the map and see where are the token √ //2. Get the location where we can put the tokens √ //> CHECK ON THE RIGHT X _ √ //> CHECK ON THE LEFT _X √ //> _ //> CHECK ON TOP X √ //> CHECK ON BOTTOM X √ //> _ //We return the positions available. ////////////////////////////////////// // [ STEP 1 ] CHECK FOR AVAILABLE POSITIONS : checks if there is some available positions, then place token to the available places, public void startCheckingForPosition() { //ResetToken nbCheckedTokens = 0; //print ("CALLED ME player : " + playerSlctColor); //Get the number of rows int theNumRows = (theField.Length / 8); //We check the rows for (int theRow = 0; theRow < theNumRows; theRow++) { //We check each elm in that row for (int incre = 0; incre < 8; incre++) { //We look for a player Token, if there is one we start looking for possible positions where to put your token. if (theField[theRow, incre] == playerSlctColor) { int firstTkenLocation = theField[theRow, incre]; //print("Found Token at: " + theTileNames[theRow,incre] + " " + theField[theRow,incre] ); //we are jsut looking on the right right now lookForAvailable(lookDirection.right, theRow, incre, firstTkenLocation); lookForAvailable(lookDirection.left, theRow, incre, firstTkenLocation); lookForAvailable(lookDirection.up, theRow, incre, firstTkenLocation); lookForAvailable(lookDirection.down, theRow, incre, firstTkenLocation); lookForAvailable(lookDirection.diagUpRight, theRow, incre, firstTkenLocation); lookForAvailable(lookDirection.diagUpLeft, theRow, incre, firstTkenLocation); lookForAvailable(lookDirection.diagDownRight, theRow, incre, firstTkenLocation); lookForAvailable(lookDirection.diagDownLeft, theRow, incre, firstTkenLocation); } //End if find user's token } //End For //##TASK IS COMPLETE ENDS THIS SCRIPT //We are done creating the map so we give the greenlight theCurrentStatus = currentStatus.taskComplete; } //End Generating } //End StartChecking
private string getWinnerName() { int leftPlayerScore = base.instedElements[1].GetComponent <scoreContaint>().getScore(); int rightPlayerScore = base.instedElements[0].GetComponent <scoreContaint>().getScore(); currentStatus cs = saveController.loadStatus(); if (rightPlayerScore > leftPlayerScore) { return(cs.playerNames[1]); } else if (rightPlayerScore < leftPlayerScore) { return(cs.playerNames[0]); } else { return("equal"); } }
//copy private void toolStripButton6_Click(object sender, EventArgs e) { if (listView1.Items.Count > 0) { //set current status currentSTT = currentStatus.copy; //reset sourceFile list //reset fileName list fileName.Clear(); sourceFile.Clear(); //init sourceFile //init fileName for (int i = 0; i < listView1.SelectedItems.Count; i++) { fileName.Add(listView1.SelectedItems[i].Text); sourceFile.Add(txtbox_path.Text + fileName[i]); } } }
void inMiniGameCorrutine() { Debug.Log("sGG"); setQuote("", lolMySoul.getQuote(previousMinigame)); //// hasta que responda el managaer basic if (endMiniGame) { Destroy(GameObject.FindGameObjectWithTag("game")); if (miniGameStatus) { swIntTransition = true; score += 1; //Destroy(GameObject.FindGameObjectWithTag("game")); swIntTransition = true; Instantiate(transitionWinGame); setQuote(); actualCurrentStatus = currentStatus.inTransitionWin; } else { swIntTransition = true; if (lives > 0) { lives--; } //Destroy(GameObject.FindGameObjectWithTag("game")); setQuote(lolMySoul.getFrase(previousMinigame)); swIntTransition = true; Instantiate(transitionLoseGame); actualCurrentStatus = currentStatus.inTransitionLose; } // yield return new WaitForSeconds (1); } else { Debug.Log("No termino el minijuego"); // yield return new WaitForSeconds (1); } }
protected override void saveCurrentStatus() { currentStatus cs = saveController.loadStatus(); cs.sphere[0] = instedElements[2].transform.position.x; cs.sphere[1] = instedElements[2].transform.position.z; cs.sphere[2] = instedElements[2].transform.eulerAngles.y; cs.paddles[1] = instedElements[1].transform.position.z; cs.score[1] = instedElements[1].GetComponent <scoreContaint>().getScore(); cs.inGame = true; cs.pauseTime = Time.time; cs.pauseTime = Time.time; cs.startTime = base.startTime; saveController.saveStatus(cs); Application.LoadLevel("pauseMeniu"); }
private void submitClicked() { currentStatus cs = saveController.loadStatus(); cs.inGame = false; if (cs.sceneName == "1player1device") { cs.playerNames[0] = input1.text.ToString(); saveController.saveStatus(cs); Application.LoadLevel("1player1device"); } else if (cs.sceneName == "2player1device") { cs.playerNames[0] = input1.text.ToString(); cs.playerNames[1] = input2.text.ToString(); saveController.saveStatus(cs); Application.LoadLevel("2player1device"); } }
private void Start() { submitNamesBtn.GetComponent <Button>().onClick.AddListener(() => submitClicked()); currentStatus cs = saveController.loadStatus(); }