/// <summary> /// We might do something intersting here for example we could give them some experience everytime they win, less if they tie, and less if they win. Then you could a simple leveling system, /// its quite easy to add that to photon networking. /// </summary> public static string setResults(int totalScore) { string resultString = ""; int otherID = Misc.getOtherPlayer(); //lets get the other score. int otherScore = GolfManager.getOtherScore(otherID); //now you might want to do something here where you are going to save how many wins, how many loses, how many ties -- then have some sort of leveling system. if (totalScore < otherScore) { resultString = "You Won!"; increaseGamesPlayed(LevelingStats.Stats.TOTAL_WINS.ToString()); } if (totalScore == otherScore) { resultString = "You Tied!"; increaseGamesPlayed(LevelingStats.Stats.TOTAL_TIES.ToString()); } if (totalScore > otherScore) { resultString = "You Lost!"; increaseGamesPlayed(LevelingStats.Stats.TOTAL_LOSES.ToString()); } return(resultString); }
void loadLevel(int levelToLoad) { #if PHOTON_MULTIPLAYER GolfManager.loadLevel(levelToLoad, PhotonNetwork.player.ID); #else Gameplay.LoadScene(levelToLoad); #endif }
//return to the main menu public void returnToMain() { #if PHOTON_MULTIPLAYER GolfManager.loadLevel(0, PhotonNetwork.player.ID); #else Gameplay.LoadScene(0); #endif }
void loadLevel(int levelToLoad) { #if PHOTON_MULTIPLAYER GolfManager.loadLevel(levelToLoad, PhotonNetwork.player.ID); #else Application.LoadLevel(levelToLoad); #endif }
//return to the main menu public void returnToMain() { #if PHOTON_MULTIPLAYER GolfManager.loadLevel(0, PhotonNetwork.player.ID); #else Application.LoadLevel(0); #endif }
public bool goToNextLevel() { bool rc = true; //int currentLevel = Utility.CurrentSceneIndex; //int courseLevel = getHoleNomUsingCourse(); int courseLevel = getHoleNomUsingCourse(); int currentLevel = m_courceController.currentHoleIndex; updateScores(courseLevel); TransitionScript ts = (TransitionScript)GameObject.FindObjectOfType(typeof(TransitionScript)); Constants.setLastSceneIndex(currentLevel + 1); if (courseLevel + 1 < HOLES_PER_COURSE + 1) { GameManager.nextScene(); /* * if (ts) * { * loadLevel(ts.sceneIndex); * } * else * { * loadLevel(currentLevel + 1); * } */ m_courceController.LoadNextHole(); currentNumberOfStrokes = 0; //get a ref to the gamescript! GameObject go = GameObject.FindWithTag("Player"); if (go) { m_ballScript = go.GetComponent <BallScript>(); } BaseGameManager.gameover(false); GolfManager.startHole(); } else { if (Constants.getPracticeMode() == false) { BaseGameManager.submitSate(); GameManager.enterState(GameScript.State.SUBMTSCORE.ToString()); } else { loadLevel(0); } rc = false; } return(rc); }
public void finishHole() { if (m_finishedHole == false) { #if PHOTON_MULTIPLAYER GolfManager.setPlayersScore(PhotonNetwork.player.ID, getTotalScore()); #else GolfManager.setPlayersScore(0, getTotalScore()); #endif GolfManager.finishHole(); m_finishedHole = true; } }
public void Update() { GameObject go; m_tick -= Time.deltaTime; for (int i = 0; i < 18; i++) { string postfix = (i + 1).ToString("00"); go = GameObject.Find("Hole" + postfix + "gt"); if (go) { scoreGTs[i] = go.GetComponent <Text>(); scoreGTs[i].text = ""; } go = GameObject.Find("Par" + postfix); if (go) { parGTs[i] = go.GetComponent <Text>(); parGTs[i].text = ""; } } int nomStrokes = m_gameScript.getNomStrokes(); int totalScore = m_gameScript.getTotalScore(); int par = m_gameScript.getPar(); int courseIndex = m_gameScript.getCourseIndex(); //we want to get the other players id. int otherID = Misc.getOtherPlayer(); m_otherID = otherID; //the other score. if (total2GT) { total2GT.text = GolfManager.getOtherScore(otherID).ToString(); } // Debug.Log ("otherID" + GolfManager.getOtherScore(otherID).ToString()); totalGT.text = totalScore.ToString(); int handicap = nomStrokes - par; string term = getTerm(nomStrokes, handicap); resultGT.text = term; showScore(); }
public void startHoleRPC() { Debug.Log("startHole"); //lets send our start hole. m_startedHole = true; GolfManager.startHole(); //only use the shot clock if we want to use it and the player is online with another player. if (useShotClock && PhotonNetwork.offlineMode == false) { if (PhotonNetwork.isMasterClient) { m_shotClock = shotClock; stopClock(); StartCoroutine(ShotClockIE()); } } }
void Start() { gm = GameObject.Find("GolfManager").GetComponent <GolfManager> (); }
public void allPlayersFinishedRPC() { stopClock(); GolfManager.everyoneFinishedHole(); m_playerFinishedCount = 0; }
public void timesUpRPC() { GolfManager.timesUp(); }