void Launch() { RemoveRigidbody(); ragdoll.Apply(); ragdoll.RootRigidbody.velocity = new Vector2(Random.Range(-launchVelocity.x, launchVelocity.x), launchVelocity.y); StartCoroutine(WaitUntilStopped()); }
public void Bail(bool showBlood) { if (m_ragdollEnabled) { return; } if (ragdoll == null) { return; } ragdoll.Apply(); m_ragdollEnabled = true; if (!isInWater) { ragdoll.RootRigidbody.velocity = new Vector2(m_RigidBody.velocity.x * 1.5f, 10); } else { ragdoll.RootRigidbody.velocity = new Vector2(m_RigidBody.velocity.x * 0.1f, -25); } int randIndex = Random.Range(0, m_RandomBailClips.Length - 1); m_OllieAudio.clip = m_RandomBailClips[randIndex]; m_OllieAudio.pitch = 1.4f; m_OllieAudio.loop = false; m_OllieAudio.Play(); // m_cameraShake.originalPos = Camera.main.transform.localPosition; // m_cameraShake.shakeDuration = 0.25f; // m_cameraShake.shakeAmount = 0.6f; if (showBlood && m_ragdollEnabled && bloodEffectsEnabled == false) { for (int i = 0; i < bloodEffects.Length; ++i) { bloodEffects[i].gameObject.SetActive(true); bloodEffects[i].GetComponent <SwfClipController>().Play(true); } bloodEffectsEnabled = true; } }