// when lap trigger is entered
    public void OnLapTrigger(trackLapTrigger _trigger)
    {
        if (_trigger == next)
        {
            player_driver _driver = gameObject.GetComponent <player_driver>();
            if (startLine.next == next)
            {
                _lap++;

                if (_driver)
                {
                    _driver.addEnergy(energyBonus * 2);
                }
            }
            else
            {
                if (_driver)
                {
                    _driver.addEnergy(energyBonus);
                }
            }
            SetNextTrigger(next);
        }
    }
Exemplo n.º 2
0
 void OnTriggerEnter2D(Collider2D col)
 {
     //*
     if (col.CompareTag("Bullet"))
     {
         if ((col.gameObject.GetComponent <bullet>()) != null)
         {
             bullet _bullet = col.gameObject.GetComponent <bullet>();
             if ((_bullet.getPlayerID()) != getPlayerID())
             {
                 driver.addEnergy(_bullet.energy_val);
                 Destroy(col.gameObject);
             }
         }
     }
 }