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

public class AddLife : MonoBehaviour {

    public GameObject life;
    
	void Start () {
		
	}
	
	void Update () {
		
	}

    void SpawnLife() {
        GameObject player = GameObject.Find("Player");
        if (player != null) {
            GameObject lifeSpawn = Instantiate(life, transform.position, transform.rotation) as GameObject;
            Vector2 lifeDirection = player.transform.position - life.transform.position;
            lifeSpawn.GetComponent<CoinScript>().SetCoinDirection(lifeDirection);
        }
    }

    
}
