I’m a total noob at C#. I’m trying to add 1 to a deathcount when someone dies. The dying part works fine, it’s not mine my friend wrote it, but I’m trying to mess with it to get this working. Here’s the code:
using UnityEngine;
using System.Collections;
public class Health : MonoBehaviour {
public class deathCounter: MonoBehaviour {
public float hitPoints = 100f;
float currentHitPoints;
// Use this for initialization
void Start () {
currentHitPoints = hitPoints;
}
void DeathWatch () {
deathCounter = deathCounter + 1;
}
[RPC]
public void TakeDamage(float amt) {
currentHitPoints -= amt;
if(currentHitPoints <= 0) {
Die();
}
}
void Die() {
if( GetComponent<PhotonView>().instantiationId==0 ) {
DeathWatch();
Destroy(gameObject);
DeathWatch();
}
else {
if( PhotonNetwork.isMasterClient ) {
PhotonNetwork.Destroy(gameObject);
}
}
}
}
}
I get this error when I compile the script after closing it:
Assets/Health.cs(15,24) error CS0119: Expression denotes a ‘type’, where a ‘variable’, ‘value’ or ‘method group’ was expected
Can anyone help? Thx