2025-09-15 23:01:07 +02:00
|
|
|
using UnityEngine;
|
|
|
|
|
|
2025-09-16 00:08:50 +02:00
|
|
|
[ExecuteAlways]
|
2025-09-15 23:01:07 +02:00
|
|
|
public class Node : MonoBehaviour
|
|
|
|
|
{
|
2025-09-16 14:20:19 +02:00
|
|
|
[Range(-1, 1)]
|
|
|
|
|
[SerializeField]
|
|
|
|
|
private int Owner = -1;
|
|
|
|
|
|
2025-09-15 23:01:07 +02:00
|
|
|
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
|
|
|
|
void Start()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
|
void Update()
|
|
|
|
|
{
|
2025-09-16 00:08:50 +02:00
|
|
|
transform.localPosition = transform.localPosition.normalized * 20f;
|
|
|
|
|
transform.forward = transform.position;
|
2025-09-16 14:20:19 +02:00
|
|
|
switch (Owner)
|
|
|
|
|
{
|
|
|
|
|
case 0:
|
|
|
|
|
transform.GetChild(0).GetComponent<Renderer>().sharedMaterial.color = Color.red; break;
|
|
|
|
|
case 1:
|
|
|
|
|
transform.GetChild(0).GetComponent<Renderer>().sharedMaterial.color = Color.green; break;
|
|
|
|
|
case -1:
|
|
|
|
|
transform.GetChild(0).GetComponent<Renderer>().sharedMaterial.color = Color.gray; break;
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-15 23:01:07 +02:00
|
|
|
}
|
|
|
|
|
}
|