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

public class Fish : MonoBehaviour {
    public int scoreAmount;
    public Transform collector;
    public float collectDistance = 3f;
    public ScoreManager scoreManager;
	
	// Update is called once per frame
	void Update () {
        transform.Rotate(Vector3.up * 90f * Time.deltaTime, Space.World);

        Vector3 vec = collector.position - transform.position;
        if(vec.sqrMagnitude < Mathf.Pow(collectDistance, 2f)) {
            scoreManager.AddScore(scoreAmount);
            gameObject.SetActive(false);
        }
	}
}
