public void OnBounce(JumpMushroom mushroom, GameObject bouncingCharacter, Vector3 bounceVelocity, Vector3 collisionPoint, Vector3 collisionNormal) { GameObject effect = (GameObject) Instantiate(effectPrefab, collisionPoint, Quaternion.LookRotation(Vector3.forward, collisionNormal)); GameControllerTemporal.AddTemporal(effect); ParticleSystem[] systems = effect.GetComponentsInChildren<ParticleSystem>(); foreach (ParticleSystem sys in systems) { sys.randomSeed = (uint)UnityEngine.Random.Range(0, int.MaxValue); sys.Simulate(0, true, true); sys.Play(); } if (scaleWithSize) { CharacterSize characterSize = bouncingCharacter.GetComponent<CharacterSize>(); effect.transform.localScale = Vector3.one; if (characterSize != null) effect.transform.localScale *= Mathf.Sqrt(characterSize.GetSize()); } Destroy(effect, effectDuration); }
public void OnBounce(JumpMushroom mushroom, GameObject bouncingCharacter, Vector3 bounceVelocity, Vector3 collisionPoint, Vector3 collisionNormal) { if (modifyPitch) _audioSource.pitch = Mathf.Lerp(minHeightPitch, maxHeightPitch, mushroom.GetVelocityFactor(bounceVelocity)); _audioSource.Play(); }
public void OnBounce(JumpMushroom mushroom, GameObject bouncingCharacter, Vector3 bounceVelocity, Vector3 collisionPoint, Vector3 collisionNormal) { foreach (Animator animator in _animators) animator.SetTrigger(ANIMATOR_TRIGGER_STRING); }