Exemple #1
0
    public void StoreShapeInGrid(BrickCar_BrickShape shape)
    {
        if (shape == null)
        {
            return;
        }

        foreach (Transform child in shape.transform)
        {
            Vector2 position = BrickCar_Vectorf.Round(child.position);
            _grid[(int)position.x, (int)position.y] = child;
        }
    }
Exemple #2
0
    public bool IsValidPosition(BrickCar_BrickShape shape)
    {
        foreach (Transform child in shape.transform)
        {
            Vector2 position = BrickCar_Vectorf.Round(child.position);

            if (!IsInGrid((int)position.x, (int)position.y))
            {
                return(false);
            }

            if (IsValidOccupied((int)position.x, (int)position.y, shape))
            {
                return(false);
            }
        }
        return(true);
    }
Exemple #3
0
    // Start is called before the first frame update
    void Start()
    {
        _timeNextLeftKey  = Time.time + _timeRepeatRateLeftKey;
        _timeNextRightKey = Time.time + _timeRepeatRateRightKey;
        _timeNextDownKey  = Time.time + _timeRepeatRateDownKey;

        _dropTimeInterval               = _timeInterval;
        _dropTimeEdgeInterval           = _timeEdgeInterval;
        _dropTimeEnemyInterval          = _timeEnemyInterval;
        _dropTimeEnemySpawnInterval     = _timeEnemySpawnInterval;
        _dropTimeEnemyFastSpawnInterval = _timeEnemyFastSpawnInterval;
        _dropTimeScoreInterval          = _timeScoreInterval;

        _backgroundGrid = FindObjectOfType <BrickCar_BackgroundGrid>();
        if (!_backgroundGrid)
        {
            Debug.Log("not assign object");
        }

        _spawner = FindObjectOfType <BrickCar_Spawner>();
        if (!_spawner)
        {
            Debug.Log("not assign object");
        }
        else
        {
            _spawner.transform.position = BrickCar_Vectorf.Round(_spawner.transform.position);

            if (!_playerShape)
            {
                _playerShape = _spawner.SpawnPlayerShape();
            }
        }

        _colider = FindObjectOfType <BrickCar_Colider>();
        if (!_colider)
        {
            Debug.Log("not assign object");
        }

        _audioManager = FindObjectOfType <BrickCar_AudioManager>();
        if (!_audioManager)
        {
            Debug.Log("not assign object");
        }

        _scoreController = FindObjectOfType <BrickCar_ScoreController>();
        if (!_scoreController)
        {
            Debug.Log("not assign object");
        }

        _animator = GetComponent <Animator>();
        if (!_animator)
        {
            Debug.Log("not assign object");
        }

        if (_pausePanel)
        {
            _pausePanel.SetActive(false);
        }
    }