Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

higorgamer

Newbie
  • Content Count

    4
  • Joined

  • Last visited

Community Reputation

4 Neutral

About higorgamer

  • Rank
    .............

Profile Information

  • Gender
    Male
  • Location:
    av beira mar
  • Interests
    em nada rapaz

Contact Methods

  1. I just put [PT] in the title to warn it would be for Brazilian \ Portuguese
  2. olá vim trazer hum roteiro Muito sinples de conversação com hum Robô rápido você pergunta e ELE Responde rsrs roteiro Meio zuado Mais Você PODE Fazer modificações parágrafo Colocar Em Algum NPC sla! #pragma estrita var imput_bot: String = ""; var BOTFalou: String = ""; funcionar OnGUI () { GUILayout.BeginHorizontal ("box", GUILayout.Width (470)); GUILayout.Label ("<b> <size = 14> Pergunta: </ size> </ b>", GUILayout.Width (130), GUILayout.Height (30)); GUILayout.Space (20); imput_bot = imput_bot.Replace ("\ n", ""); imput_bot = GUILayout.TextField (imput_bot, 70, GUILayout.Width (233), GUILayout.Height (30)); se (GUILayout.Button ("Conversar", GUILayout.Width (100), GUILayout.Height (30))) Perguntar (); GUILayout.EndHorizontal (); GUILayout.Label (BOTFalou); } funcionar Perguntar () { imput_bot = imput_bot.Replace ("", "20%"); var www: WWW = new WWW("http://www.inbot.com.br/cgi-bin/bot_gateway.cgi?server=bot.insite.com.br:8085&charset=text&pure=1&js=1&admi=&msg="+imput_bot+""); imput_bot = "Perguntando ..."; deu www; imput_bot = ""; BOTFalou = www.text; }
  3. create a file PunNewFunction.cs any folder and own post I put an example of life script and shot and how you should call the functions
  4. Hello I'm here republishing some new features to Photon using System; using System.Collections.Generic; using ExitGames.Client.Photon; using UnityEngine; using Hashtable = ExitGames.Client.Photon.Hashtable; public class PunNewFunction : MonoBehaviour { public const string matou = "Matou"; public const string morreu = "Morreu"; public const string ping = "Ping"; public enum Team : byte {none, red, blue}; public static Dictionary<Team, List<PhotonPlayer>> PlayersPerTeam; public const string TeamPlayerProp = "Time"; #region Events by Unity and Photon public void Start() { PlayersPerTeam = new Dictionary<Team, List<PhotonPlayer>>(); Array enumVals = Enum.GetValues(typeof (Team)); foreach (var enumVal in enumVals) { PlayersPerTeam[(Team)enumVal] = new List<PhotonPlayer>(); } } public void OnJoinedRoom() { this.UpdateTeams(); } public void OnPhotonPlayerPropertiesChanged(object[] playerAndUpdatedProps) { this.UpdateTeams(); } #endregion public void UpdateTeams() { Array enumVals = Enum.GetValues(typeof(Team)); foreach (var enumVal in enumVals) { PlayersPerTeam[(Team)enumVal].Clear(); } for (int i = 0; i < PhotonNetwork.playerList.Length; i++) { PhotonPlayer player = PhotonNetwork.playerList[i]; Team playerTeam = player.GetTeam(); PlayersPerTeam[playerTeam].Add(player); } } } static class KDExtensions { public static void SetPing(this PhotonPlayer player, int Ping2) { Hashtable ping = new Hashtable(); ping[PunNewFunction.ping] = Ping2; player.SetCustomProperties(ping); } public static int GetPing2(this PhotonPlayer player) { object teamId; if (player.customProperties.TryGetValue(PunNewFunction.ping, out teamId)) { return (int)teamId; } return 0; } public static void SetKill(this PhotonPlayer player, int newkill) { Hashtable matou = new Hashtable(); matou[PunNewFunction.matou] = newkill; player.SetCustomProperties(matou); } public static void AddKill(this PhotonPlayer player, int KillParaADD) { int current = player.GetKill(); current = current + KillParaADD; Hashtable matou = new Hashtable(); matou[PunNewFunction.matou] = current; player.SetCustomProperties(matou); } public static int GetKill(this PhotonPlayer player) { object teamId; if (player.customProperties.TryGetValue(PunNewFunction.matou, out teamId)) { return (int)teamId; } return 0; } public static void SetDeath(this PhotonPlayer player, int newmorreu) { Hashtable morreu = new Hashtable(); morreu[PunNewFunction.morreu] = newmorreu; player.SetCustomProperties(morreu); } public static void AddDeath(this PhotonPlayer player, int DeathParaADD) { int current = player.GetDeath(); current = current + DeathParaADD; Hashtable morreu = new Hashtable(); morreu[PunNewFunction.morreu] = current; player.SetCustomProperties(morreu); } public static int GetDeath(this PhotonPlayer player) { object teamId; if (player.customProperties.TryGetValue(PunNewFunction.morreu, out teamId)) { return (int)teamId; } return 0; } } static class TeamExtensions { public static PunNewFunction.Team GetTeam(this PhotonPlayer player) { object teamId; if (player.customProperties.TryGetValue(PunNewFunction.TeamPlayerProp, out teamId)) { return (PunNewFunction.Team)teamId; } return PunNewFunction.Team.none; } public static void SetTeam(this PhotonPlayer player, PunNewFunction.Team team) { PunNewFunction.Team currentTeam = PhotonNetwork.player.GetTeam(); if (currentTeam != team) { PhotonNetwork.player.SetCustomProperties(new Hashtable() {{PunNewFunction.TeamPlayerProp, (byte) team}}); } } } Exemple Update Ping void Update() { PhotonNetwork.player.SetPing(PhotonNetwork.player.GetPing2()); } Exemple Functions PhotonNetwork.player.SetPing(PhotonNetwork.player.GetPing2()); PhotonNetwork.player.GetPing2(); PhotonNetwork.player.SetTeam(PunNewFunction.Team.blue); PhotonNetwork.player.GetTeam(); PhotonNetwork.player.SetScore(int score); PhotonNetwork.player.AddScore(int score); PhotonNetwork.player.GetScore(); PhotonNetwork.player.SetKill(int kills); PhotonNetwork.player.AddKill(int kills); PhotonNetwork.player.GetKill(); PhotonNetwork.player.SetDeath(int deaths); PhotonNetwork.player.AddDeath(int deaths); PhotonNetwork.player.GetDeath(); Exemple Damage + Fire Team deathmatch using UnityEngine; using System.Collections; public class DanoJogador : Photon.MonoBehaviour { public float vida = 100f; public Texture TexturaDano; private float transparencia = 0f; private float Tempo = 0.0f; [RPC] public void AplicarDano(float dano, PhotonPlayer matador, string Arma) { if(photonView.IsMine) { foreach( PhotonPlayer player in PhotonNetwork.playerList) { if(player.name == matador.name) { if(matador.GetTeam() != PhotonNetwork.player.GetTeam()) { Tempo = 2.0f; vida -= dano; if(vida <= 0.0f) { PhotonNetwork.Destroy(gameObject); matador.AddKill(1); PhotonNetwork.player.AddDeath(1); } } } } } } public void Update() { if (Tempo > 0)Tempo -= Time.deltaTime; transparencia = Tempo; } public void OnGUI() { GUI.color = new Color(1.0f, 1.0f, 1.0f, transparencia); GUI.DrawTexture(new Rect(0,0,Screen.width, Screen.height), TexturaDano); } } Exemple Fire http://docs.unity3d.com/Manual/CameraRays.html using UnityEngine; using System.Collections; public class ExemploTiro: Photon.MonoBehaviour { public Camera camera; public float Dano = 10.0f public string NomeArma = ""; void Start(){ RaycastHit hit; Ray ray = camera.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, hit)) { Transform objectHit = hit.transform; hit.GetComponent<PhotonView>().AplicarDano(Dano,PhotonNetwork.player,NomeArma); } } }
×
×
  • Create New...