public override bool ApplyEffect() { m_rb = GetComponent <Rigidbody>(); AkSoundEngine.PostEvent("Planet_Rotation_Play", gameObject); m_maxRadius = float.MaxValue; if (m_rb && m_lastVel != Vector3.zero) { m_rb.velocity = m_lastVel; } if (m_rb && !m_rb.isKinematic) { ManageEffectsCollisions(); m_rb.useGravity = false; m_joint = GetComponent <MTK_JointType>(); return(true); } else { Destroy(this); return(false); } }
protected void EnableWorkshop(bool state) { MTK_Interactable current = m_dropzone.catchedObject; OnWorkshopUpdateState(state, current); if (state) { m_sound.Post(gameObject); current.isDistanceGrabbable = false; current.IndexJointUsed = 1; current.jointType.onJointBreak.AddListener(() => Destroy(m_confJoint)); current.isGrabbable = false; m_catchedObjectJoint = current.jointType; StartCoroutine(AnimateWorkshop(2, () => { current.isGrabbable = true; m_dropzone.EnableButton(); })); } else { current.IndexJointUsed = 0; current.isDistanceGrabbable = true; m_catchedObjectJoint = null; } }
public void Grab(MTK_Interactable obj) { if (obj) { // if(!obj.GetComponent<ScaleEffect>() && !obj.GetComponent<IcoSegment>()) // obj.transform.position = transform.position; if (obj.jointType.Used()) { obj.jointType.RemoveJoint(); } obj.jointType.onJointBreak.AddListener(Release); if (!obj.jointType.JoinWith(gameObject)) { obj.jointType.onJointBreak.RemoveListener(Release); return; } obj.Grab(true); m_grabbed = obj; grabbedJoint = obj.jointType; inputManager.Haptic(1); m_telekinesis.Active = false; m_handAnimator.SetBool("Visible", false); m_handAnimator.SetBool("Attract", true); m_setup.NotifyGrab(m_grabbed); // ObjectInTrigger = null; } }