public void RandomizeGraspSetting() { Component grasp = target.gameObject.GetComponent <InteractionBehaviour>(); if (grasp != null) { DestroyImmediate(grasp); } if (Random.Range(0, 2) == 0) { ComponentCopyUtility.CopyComponentAsNew <InteractionBehaviour>(source, target); } target.transform.position = originPos; target.transform.rotation = originRot; }
public void RandomizeHoverSetting() { Component singleHover = target.gameObject.GetComponent <SimpleInteractionGlow>(); Component doubleHover = target.gameObject.GetComponent <HoverByTwo>(); if (singleHover != null) { DestroyImmediate(singleHover); } if (doubleHover != null) { DestroyImmediate(doubleHover); } if (Random.Range(0, 2) == 0) { ComponentCopyUtility.CopyComponentAsNew <SimpleInteractionGlow>(source, target); } if (Random.Range(0, 2) == 0) { ComponentCopyUtility.CopyComponentAsNew <HoverByTwo>(source, target); } }