//부모 Scripts
public class E_Grabbable : MonoBehaviour
{
E_Grabber hand;
Rigidbody rb;
// Start is called before the first frame update
public virtual void Start()
{
rb = GetComponent<Rigidbody>();
}
public virtual void Update()
{
if (hand != null)
{
transform.position = hand.transform.position;
transform.rotation = hand.transform.rotation;
}
}
public virtual void DoAction()
{
}
}
//자식 Scripts
public class E_Cube : E_Grabbable
{
// Start is called before the first frame update
public override void Start()
{
base.Start();
}
// Update is called once per frame
public override void Update()
{
base.Update();
}
public override void DoAction()
{
base.DoAction();
GetComponentInChildren<Renderer>().material.color = Random.ColorHSV();
}
}