Beispiel #1
0
    void Update()
    {
        if (_obOne != null)
        {
            if (_obOne.y >= game.height)
            {
                _obOne.LateDestroy();
                _obOne = null;
            }
        }

        if (_opCar != null)
        {
            if (_opCar.y >= game.height)
            {
                _opCar.LateDestroy();
                _opCar = null;
            }
        }
    }
Beispiel #2
0
    private void SpawnCar()
    {
        int lane = rnd.Next(4);

        _opCar = new OpponentCars();

        if (lane == 1)
        {
            _opCar.x = -130;
        }

        if (lane == 2)
        {
            _opCar.x = 0;
        }

        if (lane == 3)
        {
            _opCar.x = 130;
        }
        LateAddChild(_opCar);
        TimerForOtherCars();
    }