is it possible to get a int of a game obejct when it hits another?
//GO1 public int 1, means its player 1
//GO2 // check to see what number int is on other object to see what player attacks it?
using UnityEngine;
using System.Collections;
public class EnemyHp : MonoBehaviour {
public static float EnemeyHp = 5;
public static float Hitbyplayer 0;
//------------------------------------------------------------------------------------------------------
void OnCollisionEnter(Col: Collision) {
if (Col.gameObject.tag == "PlayerBullet"){
EnemeyHp -= 1; // reduce health by 1.
// check coliding bullet see witch player owns it. ???
if(Hitbyplayer = 1){
Player1Score.Player1KillsLocal += 1;
}
if(Hitbyplayer = 2){
Player2Score.Player2KillsLocal += 1;
}
if(Hitbyplayer = 3){
Player3Score.Player3KillsLocal += 1;
}
if(Hitbyplayer = 4){
Player4Score.Player4KillsLocal += 1;
}
if(Hitbyplayer = 5){
Player5Score.Player5KillsLocal += 1;
}
Destroy(Col.gameObject);
}
} // end collision check
//------------------------------------------------------------------------------------------------------
}