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.

Search the Community

Showing results for tags 'higor'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • GENERAL
    • Introduce yourself
    • Discussions
    • Showcase
    • Need help?
    • Seeking team members?
    • Offtopic
  • RESOURCES
    • Example Projects
    • Scripts
    • Shaders
    • Unity Tutorials
    • FPS Kit Tutorials
    • 3D models
    • Animated 3D Models
    • Graphic design
    • Textures
    • Sounds
    • Other
  • SELL | REQUEST
    • Sell
    • Request
  • Mars' Modular Multiplayer Photon FPS Kit's Topics
  • Mars' Modular Multiplayer Photon FPS Kit's Reviews
  • Mars' Modular Multiplayer Photon FPS Kit's Updates
  • Mars' Modular Multiplayer Photon FPS Kit's Tutorials
  • Busy People's Introductions
  • Photon's Tutorials
  • Photon's Photon General
  • Photon's Showcase

Categories

  • Free Projects
  • Free Assets
  • Game Demos
  • Photon's Files

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


YouTube URL


Facebook URL


Twitter URL


IndieGoGo URL


Kickstarter URL


IndieDB URL


GreenLight URL


Location:


Interests

Found 1 result

  1. 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...