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

public class CowBehavior : MonoBehaviour {

    public GameObject theBullet;
    private int framesElapsed = 0;

	// Use this for initialization
	void Start () {
		
	}
	
	// Update is called once per frame
	void Update () {
        //look at player
        gameObject.transform.LookAt(GameObject.Find("FPSController").transform);

        //moove towards player
        gameObject.transform.position += 1.0f * Time.smoothDeltaTime * gameObject.transform.forward;

        //shoot the player
        if (framesElapsed >= 100)
        {

            framesElapsed = 0;
            GameObject.Instantiate(theBullet, gameObject.transform.position, gameObject.transform.rotation);
        }
        framesElapsed++;
	}
}
