public void spawnEvent(manipulator m, Vector2 gridpos) { int track = (int)_interface._gridParams.YtoUnit(gridpos.y); Vector2 io = Vector2.zero; io.x = _interface._gridParams.XtoUnit(gridpos.x + _interface._gridParams.unitSize / (2f * _interface._gridParams.snapFraction)); io.y = _interface._gridParams.XtoUnit(gridpos.x - _interface._gridParams.unitSize / (2f * _interface._gridParams.snapFraction)); timelineHandle tl = _interface.SpawnTimelineEvent(track, io).GetComponentInChildren <timelineHandle>(); tl.stretchMode = true; m.ForceGrab(tl); }
public void Copy(GameObject g, manipulator m) { if (g.GetComponent <deviceInterface>() != null) { InstrumentData data = g.GetComponent <deviceInterface>().GetData(); GameObject g2 = Instantiate(instrumentPrefabs[data.deviceType], Vector3.zero, Quaternion.identity) as GameObject; g2.GetComponent <deviceInterface>().Load(data); g2.transform.position = g.transform.position; g2.transform.rotation = g.transform.rotation; g2.transform.localScale = g.transform.localScale; m.ForceGrab(g2.GetComponentInChildren <handle>()); } }