using UnityEngine;
using System.Collections;

public class Obsticles : MonoBehaviour {
    public float scoreDiff=0;
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	
	}
    public void OnPlayerHit(Player pl)
    {
        if (scoreDiff <= 0)
            pl.Damage(-scoreDiff);
        else
            pl.AddScore(scoreDiff);
    }


    public void OnCollisionEnter(Collision cl)
    {
		print (cl.gameObject.name);
		if (cl.gameObject.name == "player")
        {
            Player pl = cl.gameObject.GetComponent<Player>();
            if(pl!=null)
            {
                OnPlayerHit(pl);
                return;
            }

        }
    }
}
