Exemplo n.º 1
0
    private bool CheckDeathObstaclesEnemies()
    {
        var obj = LevelState.instance.CheckIntersect(representation, ObjectKind.Obstacle | ObjectKind.Enemy, -obstacleCollisionTolerance);

        if (obj == null)
        {
            return(false);
        }

        PlayerDeath playerDeath = GetComponent <PlayerDeath>();

        if (obj.kind == ObjectKind.Enemy)
        {
            playerDeath.DeathEnemy();
        }
        else if (obj.kind == ObjectKind.Obstacle)
        {
            // Obstacles behind the player don't count.
            if (obj.location.bounds.middle < positionOnLane)
            {
                return(false);
            }
            playerDeath.DeathObstacle();
        }

        return(true);
    }