Question by
Wesley21spelde · Jan 18, 2016 at 07:44 PM ·
scripting problemrpchealth
please Help With RPC CALL
hey guys what im i doing wrong here ?? i dont get it . it should work right?
get this message . The requested feature is not implemented.
the idea was when someone shoots it whem your online the health gets updated on all clients What die i do wrong. I added the addjustcurrenthealth and the second parameter curhealth And as i sad it doen not work:(
using UnityEngine;
using System.Collections;
using System;
public class EnemyHealth : MonoBehaviour
{
public int maxHealth = 100;
public float curHealth = 10;
[PunRPC]
void OnCollisionEnter(Collision col)
{
if (col.transform.tag == "Bullet")
{
//Die();
PhotonView photonView = PhotonView.Get(this);
photonView.PunRPC("AddjustCurrentHealth", RPCMode.All, curHealth);
}
}
[PunRPC]
public void AddjustCurrentHealth(float adj)
{
curHealth += adj;
if (curHealth < 0)
curHealth = 0;
if (curHealth > maxHealth)
curHealth = maxHealth;
if (maxHealth < 1)
maxHealth = 1;
if (curHealth < 10)
Die();
}
[PunRPC]
void Die()
{
PhotonView.Destroy(gameObject);
}
}
Comment