public PlayerActionOnLine GetWinner() { if (gamemode == GameModeOnLine.takeflag) { foreach (PlayerActionOnLine entry in playerListIlha) { Debug.Log("flagggg" + entry.flag); if (entry.flag) { return(entry); } } } else if (gamemode == GameModeOnLine.timeatack && timeUP) { int Max = 0; PlayerActionOnLine ChosenOne = null; foreach (PlayerActionOnLine entry in playerListIlha) { if (entry.GetPlacar()[0] > Max) { Max = entry.GetPlacar()[0]; ChosenOne = entry; } } return(ChosenOne); } return(null); }
public string StatusPlayerN(int coin, int life, bool flag, NetworkPlayer Nplayer) { PlayerActionOnLine dd = GetPlayerN(Nplayer); dd.SetPlacar(coin, life, flag); return(dd.Tag + " coin " + dd.GetPlacar()[0].ToString() + " life " + dd.GetPlacar()[1].ToString()); }
bool ReceiveStatus(int coin, int life, bool flag, string playername, NetworkMessageInfo info) { if (Network.isServer) { Debug.Log("recebendo ConnectionTesterStatus"); var returnFromServer = ilha.StatusPlayer(coin, life, flag, playername); if (returnFromServer != "") { guiOnLine.HitEnter(returnFromServer, playername); PlayerActionOnLine winner = ilha.GetWinner(); if (!GameObject.Equals(winner, null)) { guiOnLine.HitEnter(winner.Name + " Venceu!!!", ""); GetComponent <NetworkView>().RPC("ReiniciarJogo", RPCMode.All); } } } return(true); }
//void OnTriggerEnter(Collider collision) //{ // if (!collision.tag.Equals("enemy")) // { // Network.Destroy(this.gameObject); // } //} void OnCollisionEnter(Collision collision) { if (GetComponent <NetworkView>().isMine) { if (!collision.gameObject.tag.Equals("chao")) { if (collision.gameObject.tag.Equals("enemy")) { PlayerActionOnLine playeraction = myPlayer.GetComponent <PlayerActionOnLine>(); playeraction.SetPlacar(100, 0, null); Debug.Log("colidiu com inmigo"); } if (collision.gameObject.tag.Contains("player") && !collision.gameObject.tag.Equals(myPlayer.tag)) { PlayerActionOnLine playeraction = myPlayer.GetComponent <PlayerActionOnLine>(); playeraction.SetPlacar(100, 0, null); Debug.Log("colidiu com Player" + collision.gameObject.tag); } // Network.Destroy(this.gameObject); } } }
public string StatusPlayer(int coin, int life, bool flag, string nome) { PlayerActionOnLine dd = GetPlayer(nome); dd.SetPlacar(coin, life, flag); return(dd.Tag + " coin " + dd.GetPlacar()[0].ToString() + " life " + dd.GetPlacar()[1].ToString()); }
public string movePlayer(String name, string comando, NetworkPlayer Nplayer) { PlayerActionOnLine dd = GetPlayerN(Nplayer); dd.Tag = comando; return(dd.Tag); }
private static bool SpecificNetworkPlayer(PlayerActionOnLine s) { if (s.networkPlayer == playertoberemoved) { return(true); } else { return(false); } }
void OnCollisionEnter(Collision collision) { if (GetComponent <NetworkView>().isMine) { //if (!collision.transform.tag.Equals("chao")) //{ // Debug.Log(collision.gameObject.name); //} if (collision.transform.name.Equals("Pes")) { Debug.Log(collision.gameObject.tag); //GameObject Player = collision.gameObject.transform.parent.gameObject; //PlayerAction playeraction = Player.GetComponent<PlayerAction>(); //playeraction.coins += 100; GetComponent <AudioSource>().PlayOneShot(smashenemy); //this.gameObject.GetComponent<Collider>().enabled = false; Network.Destroy(this.gameObject); } if (collision.transform.tag.Equals("Fireball")) { //GameObject Player = GameObject.FindGameObjectWithTag(collision.transform.name.Replace("(Clone)", "")); //PlayerActionOnLine playeraction = Player.GetComponent<PlayerActionOnLine>(); //playeraction.coins += 100; // Destroy(collision.gameObject); GetComponent <AudioSource>().PlayOneShot(smashenemy); //Network.Destroy(this.gameObject,0.50f); Network.Destroy(this.gameObject); } else if (collision.transform.tag.Contains("layer")) { Debug.Log(collision.gameObject.tag); PlayerActionOnLine playerstar = collision.transform.GetComponent <PlayerActionOnLine>(); if (playerstar.star) { GetComponent <AudioSource>().PlayOneShot(smashenemy); } } else { behind = -1 * behind; } } }
public bool AddNewPlayer(string nome, NetworkPlayer player) { Debug.Log("adddddddddddddddddddddddddddded " + nome); if (CheckNomeRepedido(nome)) { //Network.CloseConnection (info.sender, true); //Network.CloseConnection(player, true); return(false); } else { PlayerActionOnLine newPlayer = new PlayerActionOnLine(); if (!CheckTagRepedido("player2")) { newPlayer.Tag = "player2"; } else if (!CheckTagRepedido("player3")) { newPlayer.Tag = "player3"; } else if (!CheckTagRepedido("player4")) { newPlayer.Tag = "player4"; } else { newPlayer.Tag = "player1"; } newPlayer.Name = nome; newPlayer.networkPlayer = player; playerListIlha.Add(newPlayer); Debug.Log("added " + nome); return(true); } }
void OnCollisionEnter(Collision collision) { //if (collision.gameObject.tag == "chao") //{ // PlayerAction.nochao = true; // // Debug.Log("colidiu com o chao"); //} //Debug.Log(collision.gameObject.name); //if (!collision.transform.tag.Equals("Bullet")) // Destroy(collision.gameObject); if (collision.gameObject.tag.Equals("enemy")) { PlayerActionOnLine playeraction = myPlayer.GetComponent <PlayerActionOnLine>(); playeraction.SetPlacar(100, 0, null); Debug.Log("colidiu com inmigo"); } }
public bool AddNewPlayer(String name, NetworkPlayer player, PlayerActionOnLine newPlayer) { if (CheckNomeRepedido(name)) { //Network.CloseConnection (info.sender, true); Network.CloseConnection(player, true); return(false); } else { if (!CheckTagRepedido("player2")) { newPlayer.Tag = "player2"; } else if (!CheckTagRepedido("player3")) { newPlayer.Tag = "player3"; } else if (!CheckTagRepedido("player4")) { newPlayer.Tag = "player4"; } else { newPlayer.Tag = "player1"; } newPlayer.Name = name; newPlayer.networkPlayer = player; playerListIlha.Add(newPlayer); return(true); } }
void Update() { //Debug.Log(timer); if (gerente.gameState == GameState.playing) { timer += Time.deltaTime; Debug.Log(timer.ToString()); guiOnLine.UpdateTimeOnScreen(timer.ToString()); } if (timer >= gerente.setUpTimer) { EndCount(); ilha.timeUP = true; PlayerActionOnLine winner = ilha.GetWinner(); if (!GameObject.Equals(winner, null)) { guiOnLine.HitEnter(winner.Name + " Venceu!!!", ""); } else { guiOnLine.HitEnter("Ninguem venceu :(", ""); } GetComponent <NetworkView>().RPC("ReiniciarJogo", RPCMode.All); ilha.Begin(); // gerenteRede.SetGameState(GameStateOnLine.clear); //reiniciar a gurizada for each na ilha pra cada player perder os pontos } }