﻿using UnityEngine;

namespace pdinklag.CPW.Common
{
    /// <summary>
    /// Defines a ring rope.
    /// </summary>
    public class RopePrefab : MonoBehaviour
    {
        [Tooltip("The start point of the rope.")]
        public Transform StartPoint;

        [Tooltip("The end point of the rope.")]
        public Transform EndPoint;

        [Tooltip("The rope's thickness.")]
        public float Thickness = 0.05f;

        [Tooltip("The rope's tightness (mass per particle).")]
        public float Tightness = 1.0f;

        [Tooltip("The rope's base material.")]
        public Material Material;

        [Tooltip("The color of the rope.")]
        public Color Color = Color.white;

#if UNITY_EDITOR
        private void OnDrawGizmos()
        {
            if (StartPoint && EndPoint)
            {
                DebugExtension.DrawPoint(StartPoint.position, Color, 0.5f);

                Gizmos.color = Color;
                Gizmos.DrawLine(StartPoint.position, EndPoint.position);
            }
        }
#endif
    }
}
