45 lines
1.2 KiB
C#
45 lines
1.2 KiB
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
abstract public class Robot : MonoBehaviour
|
|
{
|
|
// 로봇 기본 정보
|
|
public List<Transform> jointsPosList;
|
|
public int jointCount;
|
|
public List<string> rotationDirList;
|
|
public float[] rotationValueArray;
|
|
public List<Vector3> rotationVector3List;
|
|
public GameObject[] jointUIArray;
|
|
|
|
//public GameObject[] jointUIs;
|
|
//public GameObject tcpUI;
|
|
//protected float torqueValues;
|
|
|
|
public abstract void Rotate(string[] data);
|
|
public abstract void UpdatePopupUI();
|
|
|
|
protected virtual void Start()
|
|
{
|
|
jointsPosList = new List<Transform>();
|
|
rotationDirList = new List<string>();
|
|
|
|
// 조인트, 회전 방향 매핑
|
|
Transform[] allChildren = GetComponentsInChildren<Transform>();
|
|
|
|
foreach (Transform child in allChildren)
|
|
{
|
|
if (child.tag.Equals("Joint"))
|
|
{
|
|
jointsPosList.Add(child);
|
|
|
|
rotationDirList.Add(child.name.Substring(child.name.IndexOf('(') + 1, 1));
|
|
}
|
|
}
|
|
|
|
jointCount = jointsPosList.Count;
|
|
rotationVector3List = new List<Vector3>(new Vector3[jointCount]);
|
|
rotationValueArray = new float[jointCount];
|
|
}
|
|
}
|
|
|