Ejemplo n.º 1
0
    void OnTriggerEnter(Collider col)
    {
        if (col.gameObject.tag == "car")
        {
            CarStatus carro = col.gameObject.GetComponent <CarStatus>();

            var gas = JaAbasteceu(carro.GasUnitList);
            if (gas == null)
            {
                carro.AddFuel(new Gas(GasStationId, 10));
            }
            else
            {
                if (DateTime.Now > gas.finishDate)
                {
                    carro.RemoveEmptyGas(gas);
                    carro.AddFuel(new Gas(GasStationId, 10));
                }
            }
        }
    }