private void OnTriggerEnter(Collider other)
        {
            switch (other.gameObject.tag)
            {
            case Tags.POWERUP:
                Powerup powerup = other.GetComponent <Powerup>();

                switch (powerup.GetPowerupType())
                {
                case PowerupType.BonusPoints:
                    PlayerScore.instance.AddBonusPoints(500);
                    AudioManager.instance.Play(SoundNames.BONUS_POINTS);
                    PlayerHud.instance.ShowNotification(powerup.GetColour(), "+500!");
                    break;

                case PowerupType.DoublePoints:
                    PlayerScore.instance.DoublePoints();
                    AudioManager.instance.Play(SoundNames.DOUBLE_POINTS);
                    PlayerHud.instance.ShowNotification(powerup.GetColour(), "x2!");
                    break;

                case PowerupType.Invincibility:
                    if (godModeRoutine != null)
                    {
                        StopCoroutine(godModeRoutine);
                    }
                    godModeRoutine = StartCoroutine(ActivateGodMode(5f));
                    AudioManager.instance.Play(SoundNames.INVINCIBILITY_POINTS);
                    PlayerHud.instance.ShowNotification(powerup.GetColour(), "Invincible!");
                    break;

                default:
                    Debug.Log("Warning! Unrecognised Powerup type: " + powerup.GetPowerupType());
                    break;
                }

                powerup.Relocate();
                break;

            default:
                // Nothing to do!
                break;
            }
        }
 public EPowerupType GetPowerupType()
 {
     return(_powerup.GetPowerupType());
 }
    void ResolveCollisions(RaycastHit2D hit, CollisionType collisionType, ref Vector2 velocity, float moveDir, ref float rayLength)
    {
        collisions.collided = true;

        if (collisionType == CollisionType.HORIZONTAL && hit.distance == 0)
        {
            if (hit.transform.tag != "Hazard")
            {
                return;
            }
        }

        if (hit.transform.tag != "Gravity Switch")
        {
            if (!canFlipGravity)
            {
                canFlipGravity = true;
            }
        }

        switch (hit.transform.tag)
        {
        case "Hazard":
            if (!collisions.hitHazard)     //fix after making collisions end after 1 ray... doesn't really make sense to continue w/o slopes
            {
                if (!invincible)
                {
                    OnHazard();
                    collisions.hitHazard = true;
                }
            }
            break;

        case "Powerup":
            Powerup pw = hit.collider.GetComponent <Powerup>();
            powerups.AddLast(pw.GetPowerupType());
            if (powerups.Count > powerupSize && !greedy)
            {
                powerups.RemoveFirst();
            }
            UpdatePowerupUI();
            pw.Consume();
            return;

        case "Goal":
            EntityManager.instance.levelComplete = true;
            hit.collider.GetComponent <Goal>().GoalComplete();
            return;

        case "Through":
            if (collisionType == CollisionType.VERTICAL)
            {
                if (moveDir == 1 || hit.distance == 0 || userInput.y == -1)     //watch for bugs from removing fallingThroughPlat, invoke after .5 sec delay (seblague)
                {
                    return;
                }
                break;
            }
            else
            {
                return;
            }

        case "Yoku":
            if (collisionType == CollisionType.VERTICAL)
            {
                if (hit.distance == 0)
                {
                    return;
                }
            }
            break;

        case "Ice":
            if (collisionType == CollisionType.VERTICAL)
            {
                groundAcceleration = 0.75f;
            }
            break;

        case "Gravity Switch":
            if (canFlipGravity)
            {
                FlipGravity();
                canFlipGravity = false;
                return;
            }
            else
            {
                return;
            }

        case "Entity Switch":
            hit.collider.GetComponent <Switch>().Consume();
            return;

        case "Quicksand":
            inQuicksand = true;
            return;

        case "Water":
            if (!inWater)
            {
                inWater         = true;
                this.velocity.y = Mathf.Clamp(this.velocity.y, -2f, 10f);
            }
            collisions.collidedWater = true;
            return;

        case "Checkpoint":
            spawnPoint = hit.transform.position;
            hit.collider.GetComponent <Goal>().GoalComplete();
            return;

        default:
            break;
        }

        if (collisionType == CollisionType.VERTICAL)
        {
            velocity.y = (hit.distance - SKIN_WIDTH) * moveDir;
            rayLength  = hit.distance;

            if (!gravityFlipped)
            {
                collisions.below = moveDir == -1;
                collisions.above = moveDir == 1;
            }
            else
            {
                collisions.below = moveDir == 1;
                collisions.above = moveDir == -1;
            }
        }
        else
        {
            velocity.x = Mathf.Min(Mathf.Abs(velocity.x), (hit.distance - SKIN_WIDTH)) * moveDir;
            rayLength  = Mathf.Min(Mathf.Abs(velocity.x) + SKIN_WIDTH, hit.distance);

            collisions.left  = moveDir == -1;
            collisions.right = moveDir == 1;
        }
    }