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

public class MovingPlatform : MonoBehaviour
{
    public Transform anchor;
    public Transform a;
    public Transform b;
    public ValueProvider value;
    public float speed = 2;

    private void Update()
    {
        var target = value.value ? b : a;
        anchor.position = Vector3.MoveTowards(anchor.position, target.position, speed * Time.deltaTime);
    }

    private void OnDrawGizmos()
    {
        Gizmos.color = Color.blue;
        Gizmos.DrawLine(a.position, b.position);
    }
}
