26 lines
919 B
C#
26 lines
919 B
C#
using UnityEngine;
|
|
|
|
public class MegaRuntimeAttach : MonoBehaviour
|
|
{
|
|
public GameObject ExternalRecprtor;
|
|
|
|
private void Start()
|
|
{
|
|
Vector3[] sverts = GetComponent<MegaModifyObject>().sverts;
|
|
for (int i = 0; i < sverts.Length; i++)
|
|
{
|
|
GameObject gameObject = new GameObject();
|
|
gameObject.name = "Attach" + i;
|
|
gameObject.transform.parent = base.gameObject.transform;
|
|
gameObject.transform.position = base.transform.localToWorldMatrix.MultiplyPoint3x4(sverts[i]);
|
|
MegaAttach megaAttach = gameObject.AddComponent<MegaAttach>();
|
|
megaAttach.target = base.gameObject.GetComponent<MegaModifyObject>();
|
|
megaAttach.radius = 0.1f;
|
|
megaAttach.AttachIt(base.transform.localToWorldMatrix.MultiplyPoint3x4(sverts[i]));
|
|
GameObject gameObject2 = Object.Instantiate(ExternalRecprtor);
|
|
gameObject2.transform.parent = gameObject.transform;
|
|
gameObject2.transform.localPosition = Vector3.zero;
|
|
}
|
|
}
|
|
}
|