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

public class ConveyorBelt : MonoBehaviour {

    public enum Direction
    {
        UP,
        DOWN,
        RIGHT,
        LEFT
    }

    public Direction conveyorDirection;
    public int speed;

	void OnTriggerStay(Collider col)
    {
        if (col.GetComponent<Rigidbody>())
        {
            if (conveyorDirection == Direction.UP)
            {
                col.GetComponent<Rigidbody>().AddForce(Vector3.forward * speed, ForceMode.Impulse);
            }
            else if (conveyorDirection == Direction.RIGHT)
            {
                col.GetComponent<Rigidbody>().AddForce(Vector3.right * speed, ForceMode.Impulse);
            }
            else if (conveyorDirection == Direction.LEFT)
            {
                col.GetComponent<Rigidbody>().AddForce(Vector3.left * speed, ForceMode.Impulse);
            }
            else if (conveyorDirection == Direction.DOWN)
            {
                col.GetComponent<Rigidbody>().AddForce(Vector3.back * speed, ForceMode.Impulse);
            }
        }
    }
}
