Exemplo n.º 1
0
        protected override void OnCollisionFromY(Player player, Collision colllisionInfo)
        {
            float deltaY = colllisionInfo.Delta.Y;

            if (deltaY < 0)
            {
                bounceMultiplierY = -bounceMultiplierY;
            }
            else if (PlayerImpactY >= minInpactToDetectYCollision)
            {
                bounceMultiplierY = Math.Abs(bounceMultiplierY);
                bounceBehaviour.Bounce(player);
                audioSourceBounce.Play(clipBounce);
            }
        }
        protected override void OnCollisionFromY(Player player, Collision colllisionInfo)
        {
            float deltaY = colllisionInfo.Delta.Y;

            if (deltaY < 0)
            {
                OnHit(player);
            }
            else if (PlayerImpactY >= minInpactToDetectYCollision)
            {
                bounceMultiplierY = Math.Abs(bounceMultiplierY);
                bounceBehaviour.Bounce(player);

                audioSourceBounce = new AudioSource();
                audioSourceBounce.Play(clipBounce);
                AudioManager.DisposeAudioSource(audioSourceBounce);
            }
            //else //dici al player che è grounded? mentre il player se è bounce non fa nulla??? è il player che chiama Bounce?? on collision del player viene chiamato alla fine
        }