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

public class passerBy : MonoBehaviour
{
    // Start is called before the first frame update

    // public Animator animator;
    private string animName = "walkAnim";
    public Rigidbody person;


    public float time = 15;
    public float baseSpeed = 10f;

    private float moveSpeed;

    public bool run = false;
    public bool walk = true;

    private Vector3 currentLocation;

    private Vector3 step = new Vector3(1f, 0f, 0f);

    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        if (walk == true)
        {
            moveSpeed = baseSpeed*0.4f;
            animName = "Walk";
        }
        else
        {
            moveSpeed = 0f;
            animName = "Ring";
        }

        // person.transform.position+=(step*moveSpeed)*Time.deltaTime;
        // GetComponent<Rigidbody>().AddForce(moveSpeed * transform.right, ForceMode.VelocityChange);
        transform.position += transform.forward * Time.deltaTime * moveSpeed;
    }

    void OnTriggerEnter(Collider coll)
    {
        if (coll.tag == "RingBox")
        {

        }
        if (coll.tag == "Destroyer")
        {
            Destroy(this.gameObject);
        }
        if (coll.tag == "Barker")
        {
            baseSpeed=baseSpeed*1.5f;
        }
    }
}
