void Start() { //Get the other parts of the player health = GetComponent<UniversalHealth> (); particles = GetComponent<ParticleSystem> (); //Get the other player otherPlayer = GameObject.Find(gameObject.name == "player1" ? "player2" : "player1"); }
void Start() { //Get the other parts of the player health = GetComponent <UniversalHealth> (); particles = GetComponent <ParticleSystem> (); //Get the other player otherPlayer = GameObject.Find(gameObject.name == "player1" ? "player2" : "player1"); }
void OnCollisionEnter(Collision col) { //print("collision player : " + col.gameObject.name + " player who spawned is : " + gameObject.name ); if (col.gameObject.GetComponent<UniversalHealth>() && col.gameObject != playerShooting) { //Damage whatever collided with the projectile GameObject collidedObject = col.gameObject; health = collidedObject.GetComponent<UniversalHealth>(); health.damagePlayer (projectileDamage); Destroy (gameObject, 0.5f); } }
void OnCollisionEnter(Collision col) { GameObject collidedObject = col.gameObject; if (collidedObject.name == "player1" || collidedObject.name == "player2") { //Damage whatever collided with the projectile health = collidedObject.GetComponent <UniversalHealth>(); health.damagePlayer(projectileDamage); } Destroy(gameObject); }
void OnCollisionEnter(Collision col) { GameObject collidedObject = col.gameObject; if (collidedObject.name == "player1" || collidedObject.name == "player2") { //Damage whatever collided with the projectile health = collidedObject.GetComponent<UniversalHealth>(); health.damagePlayer(projectileDamage); } Destroy(gameObject); }
void OnCollisionEnter(Collision col) { //print("collision player : " + col.gameObject.name + " player who spawned is : " + gameObject.name ); if (col.gameObject.GetComponent <UniversalHealth>() && col.gameObject != playerShooting) { //Damage whatever collided with the projectile GameObject collidedObject = col.gameObject; health = collidedObject.GetComponent <UniversalHealth>(); health.damagePlayer(projectileDamage); Destroy(gameObject, 0.5f); } }
void healPlayer(GameObject player) { UniversalHealth health = player.GetComponent <UniversalHealth> (); health.healPlayer(magnitude); }
// Use this for initialization void Start() { playerHealth = player.GetComponent <UniversalHealth> (); playerStatus = player.GetComponent <PlayerControl> (); initialiseHealthBar(); }
// Use this for initialization void Start() { playerHealth = player.GetComponent<UniversalHealth> (); playerStatus = player.GetComponent<PlayerControl> (); initialiseHealthBar (); }