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

public class zombie : Enemy
{
    public List<Transform> waypoints;
    private int index;
    private Vector3 waypointTarget;
    protected override void FixedUpdate()
    {

    }
    private void Awake()
    {
        waypointTarget = waypoints[index].position;
    }
    protected override void PatrolUpdate()
    {
        if (Vector3.Distance(waypointTarget, transform.position) <= 0f)
        {
            index = (index + 1) % waypoints.Count;
        }
        waypointTarget = waypoints[index].position;
        transform.position = Vector3.MoveTowards(transform.position, waypointTarget, Time.deltaTime * speed);
        transform.forward = (waypointTarget -transform.position ).normalized;
    }

    
}

[CustomEditor(typeof(zombie))]
public class ZombieCustomEditor : Editor
{
    private void OnSceneGUI()
    {
        var zombieObj = (zombie)target;
    }
}
