Advertisement
jasonjohn

Killfeed

Jul 18th, 2014
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3.  
  4. public class Killfeed : MonoBehaviour {
  5. public List<KillFeedInfo> KFI = new List<KillFeedInfo>();
  6. public static Killfeed inst;
  7.  
  8. // Use this for initialization
  9. void Start () {
  10. inst = this;
  11. }
  12.  
  13. // Update is called once per frame
  14. void Update () {
  15.  
  16. }
  17. void OnGUI()
  18. {
  19. GUILayout.BeginArea (new Rect (Screen.width - 100, 0, 100, 200));
  20. foreach (KillFeedInfo k in KFI)
  21. {
  22. GUILayout.BeginHorizontal();
  23. GUILayout.Label(k.Killer);
  24. GUILayout.Label(k.Gun);
  25. GUILayout.Label(k.Killer);
  26. GUILayout.EndHorizontal();
  27. }
  28. GUILayout.EndArea();
  29. }
  30. public void Server_SendKillFeed(string Killer,string Gun,string Killed)
  31. {
  32. networkView.RPC ("Client_SendKillFeed", RPCMode.All, Killer, Gun, Killed);
  33.  
  34. }
  35. [RPC]
  36. public void Client_SendKillFeed(string Killer,string Gun,string Killed)
  37. {
  38. ConvertParamsToClass (Killer, Gun, Killed);
  39. }
  40.  
  41. private void ConvertParamsToClass(string Killer,string Gun,string Killed)
  42. {
  43. KillFeedInfo k = new KillFeedInfo (Killer,Gun,Killed);
  44. KFI.Add (k);
  45. }
  46. }
  47.  
  48. [System.Serializable]
  49. public class KillFeedInfo
  50. {
  51. public KillFeedInfo(string K,string G,string V)
  52. {
  53. Killer = K;
  54. Gun = G;
  55. Killed = V;
  56. }
  57. public string Killer;
  58. public string Gun;
  59. public string Killed;
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement