void OnCollision(GameObject other)
    {
        if (other is PlayerRoadRacer)
        {
            PlayerRoadRacer _other = other as PlayerRoadRacer;
            _other.Death();

            LateDestroy();
        }
    }
Ejemplo n.º 2
0
    public LevelRoadRacer(MainGame tempGame)
    {
        _game    = tempGame;
        FileName = @"RoadRacerLevel/RoadRacer.tmx";
        Map _levelData = MapParser.ReadMap(FileName);

        SpawnRoad(_levelData);

        _obst = new Obstacles(tempGame);
        _obst.SetXY(game.width / 2, 0);
        AddChild(_obst);

        _overlay = new Overlay();
        AddChild(_overlay);
        _player = new PlayerRoadRacer(this, tempGame);
        AddChild(_player);

        Sound backgroundMusic = new Sound("Sounds/RoadRacerSong.mp3", true, true);

        _backgroundMusicChannel        = backgroundMusic.Play();
        _backgroundMusicChannel.Volume = 1f;
    }