public void Connect(GameObject jointGameObject, JointPoint jointPoint, bool sender = true) { if (!IsFree || jointPoint == null) { return; } IsFree = false; _connectedGameObject = jointGameObject; IWrapperAware wrapperAware = _connectedGameObject.GetComponentInChildren<IWrapperAware>(); if (wrapperAware != null) { _connectedWrapper = wrapperAware.Wrapper(); JointBehaviour.AddConnectedJoint(_connectedWrapper, jointPoint.JointBehaviour); } if (sender) { var jointConnectedBody = _connectedGameObject.GetComponent<Rigidbody>(); if (jointConnectedBody != null && !jointConnectedBody.isKinematic) { _fixedJoint = JointBehaviour.gameObject.AddComponent<FixedJoint>(); _fixedJoint.connectedBody = jointConnectedBody; _fixedJoint.breakForce = 600f; _fixedJoint.breakTorque = 600f; } } ConnectedJointPoint = jointPoint; ConnectedJointPoint.Connect(JointBehaviour.gameObject, this, false); }
private void Start() { CreateConnectionPreview(); RegisterIntractableEvents(); IWrapperAware wrapperAware = gameObject.GetComponentInChildren <IWrapperAware>(); Wrapper = wrapperAware != null?wrapperAware.Wrapper() : new NullWrapper(gameObject); _rigidbody = gameObject.GetComponent <Rigidbody>(); _parentOnStart = transform.parent; }
public void AddWrapper() { IWrapperAware wrapperAware = RootGameObject.GetComponentInChildren <IWrapperAware>(); if (wrapperAware != null) { Wrapper wrapper = wrapperAware.Wrapper(); WrappersCollection.Add(Id, wrapper); Entity.AddWrapper(wrapper); wrapper.InitEntity(Entity); } }
public static void EnableTouch(this IWrapperAware self, GameObject go) => self.Wrapper().GetInputController(go)?.EnableViewTouch();
public static void DisableInputGrab(this IWrapperAware self, GameObject go) => self.Wrapper().GetInputController(go)?.DisableViewGrab();
public static void EnableInputUsing(this IWrapperAware self, GameObject go) => self.Wrapper().GetInputController(go)?.EnableInputUsing();
private void Create() { _wrapperAware = GetComponentInChildren <IWrapperAware>(); }