Hi,
If I use Ray cast and check if I hit a certain player by using tag, how do I then access that hit objects scripts to check a bool?
//First I check if my ray has hit the player tagged "John"
if (hitTransform.gameObject.tag == "John" )
{
fxManager.GetComponent<PhotonView>().RPC("BloodSplash", PhotonTargets.All, transform.position, hitPoint, transform.rotation);
fxManager.GetComponent<PhotonView>().RPC("BloodSplash2", PhotonTargets.All, transform.position, hitPoint, transform.rotation);
myAttacker = this.name;
//MyAttackerAttacks();
//gameObject.GetComponent<Health>();
//Then I want to acces John's health script to see if his bool "dead" is true at the same time, but this doesn't work:
if (hitTransform.gameObject.GetComponent<Health>().dead )
{
deadShooter = false;
Debug.Log("it works");
}
}
The debug is never called, the "deadShooter " bool never becomes false. How do I do this and what am I doing wrong? All help is greatly appreciated