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

public class FireIKRandomMove : MonoBehaviour 
{
    private Vector3 _basePos;
    private Vector3 _dir;

    private float _delay = 0.35f;
    private float _prevUpdate = -1000;

    private float _range = 0.9f;

	// Use this for initialization
	void Start () 
    {
        _basePos = transform.localPosition;
	}
	
	// Update is called once per frame
	void Update () 
    {
        //flail

		if(Time.time - _prevUpdate > _delay)
        {
            _prevUpdate = Time.time;
            _dir = new Vector3(Random.Range(-_range, _range),
                Random.Range(-_range, _range),
                Random.Range(-_range, _range));

            _dir.x *= 0.5f;
        }

        transform.localPosition = Vector3.Lerp(transform.localPosition, _basePos + _dir, Time.deltaTime * 1.5f);

	}
}
