using UnityEngine;
using System.Collections;

public class RunAway : MonoBehaviour {
    private float moveSpeed = 10.5f;

    private CharacterController cc;

    public Animator anim;
    // Use this for initialization
    void Start() {
        cc = GetComponent<CharacterController>();
        anim.SetFloat("speed", 1.0f);
    }

    // Update is called once per frame
    void Update() {

        cc.Move((transform.forward + Vector3.up * -4) * Time.deltaTime * moveSpeed);

        if (transform.position.x < -162) {
            transform.position = new Vector3(105, transform.position.y + 2, -4.2f);
        }
    }
}
