Beispiel #1
0
    void OnCollisionEnter2D(Collision2D other)
    {
        if (other.gameObject.tag == "Wall")
        {
            if (other.contacts[0].normal == -(Vector2)GetDirectionAsVector())
            {
                Messenger <float> .Broadcast("screenshake", speed / 50);

                audioController.Crash(speed);
                playerGraphics.StillSprite();

                StartCoroutine("BlockControls");

                SlowDown();
                Debug.Log("Crash");
            }
            else
            {
                Messenger <float> .Broadcast("screenshake", speed / 100);

                speed -= speedDecreaseBump;
                ColorController.UpdateSpeed(GetSpeedPercentage());

                playerTail.Clear();
                Debug.Log("Close call");
            }
        }
    }