lab6
This commit is contained in:
1 parent
1b564e47e9
commit
7f65ead644
44 files changed
+4582
-2
No files matched your search
@@ -0,0 +1,37 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.Lab6
|
||||
{
|
||||
[System.Serializable]
|
||||
public class Vertex : MonoBehaviour
|
||||
{
|
||||
public int id = -1;
|
||||
public List<Edge> neighbours;
|
||||
[HideInInspector]
|
||||
public Vertex prev;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
neighbours ??= new List<Edge>();
|
||||
}
|
||||
|
||||
private void OnDrawGizmos()
|
||||
{
|
||||
Gizmos.color = Color.cyan;
|
||||
Gizmos.DrawSphere(transform.position, 0.2f);
|
||||
}
|
||||
|
||||
private void OnDrawGizmosSelected()
|
||||
{
|
||||
if (neighbours == null) return;
|
||||
|
||||
Gizmos.color = Color.yellow;
|
||||
foreach (var edge in neighbours.Where(edge => edge?.Vertex != null))
|
||||
{
|
||||
Gizmos.DrawLine(transform.position, edge.Vertex.transform.position);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user