Hello,
currently I’m trying to send the state of the client/server gameobject to all people on the same server
The other players on the server can’t see if I switch my PlayerMode. So you start in Hunter mode and when I switch to Hunted the others can’t see that. They see my still as Hunter
This is my code:
var PlayerMode : int = 0; // 0 = Hunter, 1 = Hunted
var Hunter : GameObject;
var Hunted : GameObject;
function Start () {
}
function Update () {
var viewID : NetworkViewID= Network.AllocateViewID();
networkView.RPC("SetPlayerMode", RPCMode.AllBuffered, viewID, PlayerMode);
if(networkView.isMine && Input.GetKey(KeyCode.Alpha2)){
PlayerMode = 0;
}
if(networkView.isMine && Input.GetKey(KeyCode.Alpha1)){
PlayerMode = 1;
}
}
@RPC
function SetPlayerMode (viewID : NetworkViewID, Mode : int) {
var nView : NetworkView;
if(PlayerMode == 0){
Hunted.gameObject.active = false;
Hunter.gameObject.active = true;
nView = Hunter.GameObject();
nView.viewID = viewID;
}
if(PlayerMode == 1){
Hunted.gameObject.active = true;
Hunter.gameObject.active = false;
nView = Hunted.GameObject();
nView.viewID = viewID;
}
}
I miss something and I don’t know how to get this work/go on to get this working.
Thank you. Hope you guys can help me