- Home /
Question by
Wesley21spelde · Jan 19, 2016 at 08:53 AM ·
scripting problemnetworkview
NetworkView
Hey guys i tried this but still getting errors What is wrong why is it not working does enyone know?? RPCMode is marked With a red line
public new NetworkView networkView;
void Awake()
{
networkView = GetComponent<NetworkView>();
}
[PunRPC]
void OnCollisionEnter(Collision col)
{
if (col.transform.tag == "Bullet")
{
networkView.RPC("AddjustCurrentHealth", RPCMode.All);
//Die();
//PhotonView photonView = PhotonView.Get(this);
//photonView.RPC("AddjustCurrentHealth", RPCMode.All, curHealth);
}
}
[PunRPC]
public void AddjustCurrentHealth(int adj)
{
curHealth += adj;
if (curHealth < 0)
curHealth = 0;
if (curHealth > maxHealth)
curHealth = maxHealth;
if (maxHealth < 1)
maxHealth = 1;
if (curHealth < 10)
Die();
}
}
Comment