void Update() { if (Application.loadedLevel > 0 && m_loadedLevel == false) { BaseGameManager.spawnPlayers(m_nomHumans, m_aiToSpawn); m_loadedLevel = true; } }
public void press() { if (m_state != State.DONE) { BaseGameManager.powerbarPress(this); m_state = State.DONE; } }
void fireShot() { //the middle is 0.5, we add some variance. float horz = 0.5f + Random.Range(-variance, variance); float vert = 0.5f + Random.Range(-variance, variance); BaseGameManager.setDart(horz, vert); }
IEnumerator changeTurnIE() { yield return(new WaitForSeconds(waitTimeBeforeChangeRounds)); BaseGameManager.resetDarts(); BaseGameManager.playersTurn(m_playerTurn); BaseGameManager.resetFireButton(); if (dartUI) { dartUI.resetBar(m_playerTurn); } }
void toggleAudio() { if (PlayerPrefs.GetFloat("AudioVolume", 0) == 0) { PlayerPrefs.SetFloat("AudioVolume", 1f); } else { PlayerPrefs.SetFloat("AudioVolume", 0f); } BaseGameManager.toggleAudio(); }
void OnCollisionEnter(Collision col) { if (m_hitSomething == false) { DartField dartField = col.gameObject.GetComponent <DartField>(); GetComponent <Rigidbody>().isKinematic = true; m_hitSomething = true; //m_rotator.enabled=true; if (dartField) { BaseGameManager.dartHitBoard(dartField.score, dartField.fieldType); } } }
public void onPowerbarPress(Powerbar powerbar) { if (m_myTurn) { Powerbar.PowerbarType ptype = powerbar.getPowerbarType(); if (ptype == Powerbar.PowerbarType.HORZ) { horz = powerbar.getValueAsScalar(); } if (ptype == Powerbar.PowerbarType.VERT) { vert = powerbar.getValueAsScalar(); BaseGameManager.setDart(horz, vert); } } }
void handleStartGame() { int enemy = PlayerPrefs.GetInt("Enemy", 0); int nomHumans = 1; int nomAI = 0; if (enemy == 1) { nomAI = 1; } if (enemy == 2) { nomHumans = 2; } BaseGameManager.connect(true, getLevelToLoad(), nomHumans, nomAI); }
//spawn the objects owned by the master client. public void onSpawnPlayers(int localHumansToSpawn, int nomAI) { { //the humans will as well. for (int i = 0; i < localHumansToSpawn; i++) { spawnPlayer(i + 1); } //the ai will be owned by the master client for (int i = 0; i < nomAI; i++) { spawnAI(i); } } BaseGameManager.startGame(); }
void onDartHitBoard(int score, DartField.FieldType fieldType) { if (m_gameType == GameType.SCORE_ATTACK) { m_score[m_playerTurn] -= score; Debug.Log("m_score[m_playerTurn]" + m_score[m_playerTurn]); if (m_score[m_playerTurn] < 0 && Application.loadedLevel != 0) { m_score[m_playerTurn] = 0; Debug.Log("GAMEOVER MAN"); BaseGameManager.gameover(m_playerTurn == 0); } } else { if (score == m_score[m_playerTurn]) { m_score[m_playerTurn]++; if (m_score[m_playerTurn] >= 20) { BaseGameManager.gameover(m_playerTurn == 0); } } } if (scoreTexts != null && m_playerTurn < scoreTexts.Length && scoreTexts[m_playerTurn] != null) { scoreTexts[m_playerTurn].text = m_score[m_playerTurn].ToString(); } m_dartIndex++; m_dartIndex2++; if (m_dartIndex2 > 2) { m_dartIndex2 = 0; if (m_nomPlayers > 1) { if (playerImages[m_playerTurn] != null) { playerImages[m_playerTurn].color = Color.gray * .5f; } m_playerTurn ^= 1; if (playerImages[m_playerTurn] != null) { playerImages[m_playerTurn].color = Color.gray; } } if (m_playerTurn == 0) { m_dartIndex = 0; } StartCoroutine(changeTurnIE()); } else { if (dartUI) { dartUI.resetBar(m_playerTurn); } } }
void onSetDart(float hrz, float vrt) { Debug.Log("hrz " + hrz + " vrt" + vrt); BaseGameManager.fireDart(m_dartIndex, hrz, vrt, m_score[m_playerTurn]); }
public virtual void onPress() { BaseGameManager.buttonPress(gameObject.name); }