Quantcast
Channel: Questions in topic: "help me"
Viewing all articles
Browse latest Browse all 115

Variable Adding Error

$
0
0
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().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

Viewing all articles
Browse latest Browse all 115

Trending Articles



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