Quantcast
Channel: Questions in topic: "online game"
Viewing all articles
Browse latest Browse all 36

How do I create an online object counter

$
0
0
I'm sorry for my English if something is wrong, well what happens is that I have decided to create an online horror game, what happens is that I want when a player takes a soul to show it to the other player, apparently the accountant bugea and the other player gets 0/7 and another 5/7 The code is in Spanish Here the script (JS): var Almas : int; var AlmasLimit = 7; var SceneWinGame : String; var chatScript : FPSChat; function OnTriggerEnter(other : Collider){ if(other.gameObject.tag == "Alma"){ networkView.RPC("AlmaRecogida", RPCMode.All, Almas); Destroy(other.gameObject); } } function OnGUI(){ if(networkView.isMine){ GUILayout.Label("ALMAS: " + Almas + " / " + AlmasLimit); } } function Update(){ if(Almas == 7){ networkView.RPC("WinGame", RPCMode.All, SceneWinGame); } } @RPC function AlmaRecogida(alma : int){ Almas = alma; alma += 1; } @RPC function WinGame(LoadScene : String){ SceneWinGame = LoadScene; Application.LoadLevel("Win_Scene"); }

Viewing all articles
Browse latest Browse all 36

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>