// Use this for initialization void Start() { var managers = GameObject.FindGameObjectWithTag("Managers"); _gameManager = managers.GetComponent <GameManagerScript>(); _brickManager = managers.GetComponent <BrickManagerScript>(); _powerupManager = managers.GetComponent <PowerupManagerScript>(); _soundManager = managers.GetComponent <SoundManagerScript>(); _brickDestroyEffect = GameObject.FindGameObjectWithTag("ParticleBrickDestroy"); PointValue = 10; HealthTotal = DefaultBrickHealth; Reset(); }
// Use this for initialization void Start() { _powerupAnchor = GameObject.Find("PowerupAnchor"); _gameManager = GameObject.FindGameObjectWithTag("Managers").GetComponent <GameManagerScript>(); _paddleManager = GameObject.FindGameObjectWithTag("Managers").GetComponent <PaddleManagerScript>(); _brickManager = GameObject.FindGameObjectWithTag("Managers").GetComponent <BrickManagerScript>(); _soundManager = GameObject.FindGameObjectWithTag("Managers").GetComponent <SoundManagerScript>(); _powerupTypes = new List <string>(); SetUpPowerupTypes(); _powerups = new List <GameObject>(_powerupTypes.Count * PowerupInstancesPerType); _percentages = new List <float>(_powerupTypes.Count); SetUpPercentages(); CreatePowerups(); }
public BrickRing(int numberOfBricks, int brickHealth, BrickManagerScript brickManager) { Anchor = new GameObject { name = "Brick Ring Anchor" }; var brickPrefab = brickManager.BrickPrefab; for (var i = 0; i < numberOfBricks; i++) { var newBrick = Instantiate(brickPrefab, Vector3.zero, Quaternion.identity) as GameObject; newBrick.transform.parent = Anchor.transform; newBrick.transform.localEulerAngles = new Vector3(0, 0, 360.0f / numberOfBricks * i); newBrick.transform.localPosition = (newBrick.transform.rotation * new Vector3(0, -1.7f, 0)); newBrick.GetComponent <BrickScript>().SetBrickHealth(brickHealth); } }
// Use this for initialization void Start() { IsPaused = true; IsStarted = false; TimerStarted = false; _currentState = 0; _textPointScore = _actualPointScore = 0; _timer = 0; _speedIncreaseTimer = 0; _eventCreated = false; _comboTimer = 0; _backgroundColourIndex = 1; _currentLevel = 1; // Camera shake _camera = Camera.main; _paddleManager = GetComponent <PaddleManagerScript>(); _brickManager = GetComponent <BrickManagerScript>(); _soundManager = GetComponent <SoundManagerScript>(); _eventManager = GameObject.FindGameObjectWithTag("EventText").GetComponent <EventTextScript>(); _inGameMenu = GameObject.FindGameObjectWithTag("InGameMenu"); _controlSlider = GameObject.FindGameObjectWithTag("ControlSlider"); _scoreText = GameObject.FindGameObjectWithTag("ScoreText").GetComponent <Text>(); _timeText = GameObject.FindGameObjectWithTag("TimeText").GetComponent <Text>(); _comboText = GameObject.FindGameObjectWithTag("ComboText").GetComponent <Text>(); _backgroundImage = GameObject.FindGameObjectWithTag("BackgroundImage").GetComponent <SpriteRenderer>(); _innerRing = GameObject.FindGameObjectWithTag("InnerRing").GetComponent <InnerRingScript>(); _comboText.enabled = false; var obj = GameObject.FindGameObjectWithTag("DebugText"); if (obj) { _debugText = obj.GetComponent <Text>(); } }