private void EnemySpawn() { _timeNextEnemySpawn = Time.time + _dropTimeEnemySpawnInterval; _timeNextEnemyFastSpawn = Time.time + _dropTimeEnemyFastSpawnInterval; _enemyShape = _spawner.SpawnEnemyShape(); }
public bool IsOverLimit(BrickCar_BrickShape shape) { foreach (Transform child in shape.transform) { if (child.transform.position.y >= (height - header)) { return(true); } } return(false); }
public bool IsBelowLimit(BrickCar_BrickShape shape) { foreach (Transform child in shape.transform) { if (child.transform.position.y <= -5) { return(true); } } return(false); }
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; } }
public BrickCar_BrickShape SpawnPlayerShape() { if (!_queuedPlayerShape) { _queuedPlayerShape = Instantiate(GetPlayerShape(), playerPosition.position, Quaternion.identity); _queuedPlayerShape.transform.parent = playerPosition.transform; return(_queuedPlayerShape); } else { Debug.Log("invalid shape"); return(null); } }
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); }
public BrickCar_BrickShape SpawnEnemyShape() { if (!_queuedEnemyShape) { _queuedEnemyShape = Instantiate(GetRandomEnemyShape(), transform.position, Quaternion.identity); _queuedEnemyShape.transform.position = transform.position + _queuedEnemyShape._queuedOffset; _queuedEnemyShape.transform.parent = enemyContrainer.transform; return(_queuedEnemyShape); } else if (_queuedEnemyShape) { _queuedEnemyShape = Instantiate(GetRandomEnemyShape(), transform.position, Quaternion.identity); _queuedEnemyShape.transform.position = transform.position + _queuedEnemyShape._queuedOffset; _queuedEnemyShape.transform.parent = enemyContrainer.transform; return(_queuedEnemyShape); } else { Debug.Log("invalid shape"); return(null); } }
// 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); } }
private bool IsValidOccupied(int x, int y, BrickCar_BrickShape shape) { return(_grid[x, y] != null && _grid[x, y].parent != shape.transform); }