public void OnMonsterTakesDamage(BPilot pilot) { // dies if the pilot has no hp if (pilot.state.hp <= 0) { //this.EndGame(pilot.enemy.GetComponent<BPilot>().pilotID); this.photonView.RPC("EndGame", PhotonTargets.All, pilot.enemy.GetComponent <BPilot>().pilotID); } }
public void EndGame(int winnerID) { BPilot winner = this.pilotsGO[winnerID].GetComponent <BPilot>(); // disable all monsters foreach (GameObject pilot_go in pilotsGO) { pilot_go.SetActive(false); } this.GetComponent <BEndGame>().EndGameScreen( winner.data.monsterName + " " + "(Player " + (winner.pilotID == 0 ? "A" : "B") + ") " + "Wins!" ); }