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

public class MonsterBehaviour : MonoBehaviour
{
    Transform tf;
    GameObject go;
    bool shake;
    // Start is called before the first frame update
    void Start()
    {
        tf = GetComponent<Transform>();
        go = GameObject.Find("player");
    }

    // Update is called once per frame
    void Update()
    {
        tf.LookAt(go.transform.position);
        transform.Rotate(new Vector3(15, 30, 45) * Time.deltaTime);
        tf.position = Vector3.MoveTowards(tf.position, go.transform.position,100f*Time.deltaTime);
        //StartCoroutine(Shake());
    }
    /*
    IEnumerator Shake()
    {
        while (true)
        {
            if (shake)
            {
                tf.position += Vector3.up *10.0f ;
            }
            else
            {
                tf.position -= Vector3.up * 10.0f;
            }
            shake = !shake;
            yield return new WaitForSeconds(0.01f);
        }
    }
    */
}
