using System.Collections.Generic;
using UnityEngine;

public class TerrainVertex : GameVertex {
    private List<TerrainSegment> segments = new List<TerrainSegment>();

    public TerrainVertex(Vector2 point) : base(point) {
    }

    public TerrainVertex(double x, double y) : base(x, y) {
    }

    public void link(TerrainSegment s) {
        segments.Add(s);
    }

    public override bool Equals(object obj) {
        TerrainVertex other = obj as TerrainVertex;

        if (other == null) {
            return false;
        }

        return (other.vec - vec).magnitude < 1;
    }

    public override int GetHashCode() {
        return (int)(Mathf.Round(vec.x) * 10000 + Mathf.Round(vec.y));
    }
}