コード例 #1
0
 void OnCollision(GameObject other)
 {
     if (other is PlayerRoadRacer)
     {
         _game.AddTickets(5);
         _game.ticketsReceived += 5;
         LateDestroy();
     }
 }
コード例 #2
0
    // Code for collisions with powerups
    void OnCollision(GameObject other)
    {
        if (other is PowerUpLarge)
        {
            this.scaleX = 0.3f;

            LateAddChild(new Timer(10000, TimerOver));
        }
        else if (other is PowerUpHealth)
        {
            if (_lives < 3)
            {
                PlusLives();
            }

            _game.AddTickets(5);
            _game.ticketsReceived += 5;
        }
    }