using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DamageAssistent : MonoBehaviour {

	public int damage=10;
	public int scoreGain = 1;
	public int ownerID;
	public PlayerController playerController;

	void Start(){
		ownerID = playerController.playerID;
	}

	void OnTriggerEnter2D(Collider2D collider){
		if (collider.gameObject.tag == "Player") {
			PlayerController targetPlayer = collider.gameObject.GetComponent<PlayerController> ();
			if (playerController.team != targetPlayer.team) {
				if (targetPlayer.playerID != ownerID) {
					targetPlayer.BeHit (damage,playerController);
				}
			}
		}
	}
}
