24 lines
773 B
C#
24 lines
773 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
public class TechNodeConnector : MonoBehaviour
|
|
{
|
|
private UnityEngine.UI.Image image;
|
|
// Start is called before the first frame update
|
|
void Awake()
|
|
{
|
|
image = GetComponent<UnityEngine.UI.Image>();
|
|
}
|
|
public void MakeConnections(Vector3 fromPoint, Vector3 toPoint, Color color)
|
|
{
|
|
image.color = color;
|
|
Vector3 centerPosition = (fromPoint + toPoint) / 2;
|
|
Vector3 direction = Vector3.Normalize(fromPoint - toPoint);
|
|
transform.right = direction;
|
|
transform.position = centerPosition;
|
|
transform.localScale = new Vector3(Vector3.Distance(fromPoint, toPoint) / 10, 1, 1);
|
|
transform.SetAsFirstSibling();
|
|
}
|
|
}
|
|
|